= 0x81 ) {
$tmpstr = iconv( "gbk" , "utf-16" , $buffer[$i].$buffer[$i+1] );
$uni = hexdec( bin2hex( $tmpstr[3].$tmpstr[2] ) );
$unicode .= "".$uni.";";
$i++;
}
else {
$unicode .= $string[$i];
}
}
return $unicode;
} } /* ecstart_gbk2htmlunicode */
/* ********** ********** ********** ********** ********** */
if ( !function_exists('ecstart_utf8_convert') ) {
function ecstart_utf8_convert( $buffer ){
$buffer = iconv( "utf-8" , "gbk" , $buffer );
$buffer = ecstart_gbk_convert( $buffer );
return $buffer;
} } /* ecstart_utf8_convert */
/* ******* ********** ********** ********** ********** ********** ********** ********** ********** **********
** Function For Show Code
********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Parameter Description :
** ========== ========== ========== ========== ==========
** $iText Input String
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Maintainence History
** ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
** Modify Date :
** Modify By :
** Changes :
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('fShowCD') ) {
function fShowCD($iText) {
echo "
";
echo "
";
echo "";
echo $iText;
echo "";
echo "
";
echo "";
} } /* fShowCD */
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** **********
** Function For Show Error Message
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Parameter Description :
** ========== ========== ========== ========== ==========
** $iText Input String
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Maintainence History
** ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
** Modify Date :
** Modify By :
** Changes :
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('fShowErr') ) {
function fShowErr($iText) {
echo "";
echo "
";
echo "";
echo $iText;
echo "";
echo "
";
echo "";
} } /* fShowErr */
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** **********
** Function For Show Message
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Parameter Description :
** ========== ========== ========== ========== ==========
** $iText Input String
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Maintainence History
** ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
** Modify Date :
** Modify By :
** Changes :
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('fShowMsg') ) {
function fShowMsg($iText) {
echo "";
echo "
";
echo "";
echo $iText;
echo "";
echo "
";
echo "";
} } /* fShowMsg */
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** **********
** Function For Copy Resize Image
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Parameter Description :
** ========== ========== ========== ========== ==========
** $iFiles Input Image File Location
** $iX Output Image Maximum Width
** $iY Output Image Maximum Height
** $iPath Output Image Location
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Maintainence History
** ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
** Modify Date : 2012-05-31
** Modify By : Jimmy
** Changes : 1. Add Coding For Support Transparent Image
** 2. Modify Output File Format To Original Image
** Type
** ========== ========== ========== ========== ==========
** Modify Date :
** Modify By :
** Changes :
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('fCpyResizeImg') ) {
function fCpyResizeImg($iFiles,$iX,$iY,$iPath) {
$RtVal = true;
if ( is_uploaded_file($iFiles['tmp_name']) ) {
if ( $size = getimagesize($iFiles['tmp_name']) ) {
/* ---------- ---------- ---------- ---------- ---------- */
/* Calculate Image Size */
$imageX = $size[0]; $imageY = $size[1];
$resizeRatioX = $iX / $imageX;
$resizeRatioY = $iY / $imageY;
if ($resizeRatioX < $resizeRatioY ){
if ( $resizeRatioX >= 1 ) {
/* For Small Photo Keep Original Size */
$thumbX = $imageX;
$thumbY = $imageY;
}
else {
$thumbX = $iX;
$thumbY = intVal( $imageY * $resizeRatioX );
} }
else {
if ( $resizeRatioY >= 1 ) {
/* For Small Photo Keep Original Size */
$thumbX = $imageX;
$thumbY = $imageY;
}
else {
$thumbY = $iY;
$thumbX = intVal( $imageX * $resizeRatioY );
} }
/* ---------- ---------- ---------- ---------- ---------- */
switch ( $iFiles['type'] ) {
/* +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ */
case "image/jpeg" :
case "image/pjpeg" :
/* Get Input Image */
if ( $getImage = imagecreatefromjpeg($iFiles['tmp_name']) ) {
} // imagecreatefromjpeg
else { $RtVal = false; }
break;
/* +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ */
case "image/gif" :
/* Get Input Image */
if ( $getImage = imagecreatefromgif( $iFiles['tmp_name'] ) ) {
$bgImage = imagecreatetruecolor( $imageX , $imageY );
$bgColor = imagecolorallocate( $bgImage , 0xDA , 0xD6, 0xCA ); //DAD6CA
imagefill( $bgImage , 0 , 0 , $bgColor );
imagecopymerge( $bgImage , $getImage , 0 , 0 , 0 , 0 , $imageX , $imageY , 75 );
$getImage = $bgImage;
} // imagecreatefromjpeg
else { $RtVal = false; }
break;
/* +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ */
case "image/png" :
case "image/x-png" :
/* Get Input Image */
if ( $getImage = imagecreatefrompng($iFiles['tmp_name']) ) {
} // imagecreatefromjpeg
else { $RtVal = false; }
break;
/* +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ */
default:
/* Invalid Image Format */
$RtVal = false;
fShowMsg( $iFiles['type'] );
break;
} /* switch */
if ( $RtVal != false ) {
/* Copy Image */
/* Act For Thumbnail Photo */
if ( function_exists('imagecreatetruecolor') )
{
$RtVal = ( $thumbImage = imagecreatetruecolor($thumbX, $thumbY) );
}
else
{
$RtVal = ( $thumbImage = imagecreate($thumbX, $thumbY) );
}
/* For Transparent Image */
if ( $RtVal )
{ /* $RtVal */
/* ---------- ---------- ---------- ---------- ---------- */
switch ( $iFiles['type'] ) {
/* +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ */
case "image/gif" :
/* +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ */
case "image/png" :
case "image/x-png" :
$RtVal = imagealphablending($thumbImage, false);
$RtVal = imagesavealpha($thumbImage,true);
$transparent = imagecolorallocatealpha($thumbImage, 255, 255, 255, 127);
$RtVal = imagefilledrectangle($thumbImage, 0, 0, $thumbX, $thumbY, $transparent);
break;
/* +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ */
case "image/jpeg" :
case "image/pjpeg" :
break;
/* +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ */
default:
break;
} /* switch */
} /* $RtVal */
if ( $RtVal )
{ /* $RtVal */
$RtVal = imagecopyresampled( $thumbImage, $getImage
, 0, 0, 0, 0
, $thumbX , $thumbY
, $imageX , $imageY);
} /* $RtVal */
// Save Image
if ( $RtVal )
{ /* $RtVal */
/* ---------- ---------- ---------- ---------- ---------- */
switch ( $iFiles['type'] ) {
/* +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ */
case "image/gif" :
$RtVal = imagegif($thumbImage,$iPath);
break;
/* +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ */
case "image/png" :
case "image/x-png" :
$RtVal = imagepng($thumbImage,$iPath);
break;
/* +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ */
case "image/jpeg" :
case "image/pjpeg" :
$RtVal = imagejpeg($thumbImage,$iPath,100);
break;
/* +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ */
default:
break;
} /* switch */
} /* $RtVal */
}
} /* getimagesize */
else { $RtVal = false; }
} /* is_uploaded_file */
else { $RtVal = false; }
return $RtVal;
} } /* fCpyResizeImg */
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** **********
** Function For Extry Box Show Value
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Parameter Description :
** ========== ========== ========== ========== ==========
** $iText Input String
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Maintainence History
** ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
** Modify Date :
** Modify By :
** Changes :
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('fBoxVal') ) {
function fBoxVal( $iText ) {
$oText = $iText;
/* Chop Escape Character */
$oText = fBoxChop( $oText );
$oText = htmlspecialchars( $oText );
return $oText;
} } /* fBoxVal */
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** **********
** Function For Extry Box Show Value Chop Escape Char
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Parameter Description :
** ========== ========== ========== ========== ==========
** $iText Input String
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Maintainence History
** ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
** Modify Date :
** Modify By :
** Changes :
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('fBoxChop') ) {
function fBoxChop( $iText ) {
$oText = $iText;
/* Chop */
$oText = str_replace( '\\\\' , '\\' , $oText );
$oText = str_replace( '\"' , '"' , $oText );
$oText = str_replace( "\'" , "'" , $oText );
return $oText;
} } /* fBoxChop */
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** **********
** Function For Show SQL
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Parameter Description :
** ========== ========== ========== ========== ==========
** $iText Input String
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Maintainence History
** ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
** Modify Date :
** Modify By :
** Changes :
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('fShowSQL') ) {
function fShowSQL($iText) {
$oText = $iText;
/* Chop */
$oText = str_replace( 'IF ' , 'IF ' , $oText );
$oText = str_replace( 'BEGIN' , '
BEGIN ' , $oText );
$oText = str_replace( 'SELECT ' , '
SELECT ' , $oText );
$oText = str_replace( 'INSERT ' , '
INSERT ' , $oText );
$oText = str_replace( 'UPDATE ' , '
UPDATE ' , $oText );
$oText = str_replace( 'DELETE ' , '
DELETE ' , $oText );
$oText = str_replace( 'REPLACE ' , '
REPLACE ' , $oText );
$oText = str_replace( 'GROUP BY ' , '
GROUP BY ' , $oText );
$oText = str_replace( 'ORDER BY ' , '
ORDER BY ' , $oText );
$oText = str_replace( ' DESC ' , ' DESC ' , $oText );
$oText = str_replace( ' ASC ' , ' ASC ' , $oText );
$oText = str_replace( ' SET ' , '
SET ' , $oText );
$oText = str_replace( ' AS ' , ' AS ' , $oText );
$oText = str_replace( ' FROM ' , '
FROM ' , $oText );
$oText = str_replace( ' WHERE ' , '
WHERE ' , $oText );
$oText = str_replace( ' AND ' , '
AND ' , $oText );
$oText = str_replace( ' OR ' , '
OR ' , $oText );
$oText = str_replace( ' LEFT ' , '
LEFT ' , $oText );
$oText = str_replace( ' RIGHT ' , '
RIGHT ' , $oText );
$oText = str_replace( ' INNER ' , '
INNER ' , $oText );
$oText = str_replace( ' OUTER ' , ' OUTER ' , $oText );
$oText = str_replace( ' JOIN ' , ' JOIN ' , $oText );
$oText = str_replace( ' ON ' , '
ON ' , $oText );
$oText = str_replace( ' CASE ' , ' CASE ' , $oText );
$oText = str_replace( ' WHEN ' , '
WHEN ' , $oText );
$oText = str_replace( ' THEN ' , ' THEN ' , $oText );
$oText = str_replace( ' EXISTS ' , ' EXISTS ' , $oText );
$oText = str_replace( ' INTO ' , ' INTO ' , $oText );
$oText = str_replace( ' ELSE ' , '
ELSE ' , $oText );
$oText = str_replace( ' END ' , '
END ' , $oText );
$oText = str_replace( ' SUM(' , ' SUM(' , $oText );
$oText = str_replace( ' MAX(' , ' MAX(' , $oText );
$oText = str_replace( ' MIN(' , ' MIN(' , $oText );
$oText = str_replace( ' COUNT(' , ' COUNT(' , $oText );
$oText = str_replace( ' CONCAT(' , ' CONCAT(' , $oText );
$oText = str_replace( ' COALESCE(' , ' COALESCE(' , $oText );
$oText = str_replace( ' SUBSTRING(' , ' SUBSTRING(' , $oText );
$oText = str_replace( ' , ' , '
, ' , $oText );
$oText = str_replace( ' , ' , '
, ' , $oText );
$oText = str_replace( ' ` ' , ' ` ' , $oText );
echo "";
echo "
";
echo "";
echo $oText;
echo "";
echo "
";
echo "";
} } /* fShowSQL */
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** **********
** Function For Remove Tag
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Parameter Description :
** ========== ========== ========== ========== ==========
** $iText Input String
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Maintainence History
** ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
** Modify Date :
** Modify By :
** Changes :
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('fRemoveTag') ) {
function fRemoveTag($iText) {
$oText = $iText;
$tagCnt = substr_count( $oText , "<" );
/* Remove Invisible String */
$oText = str_replace( "\r\n" , " " , $oText );
$oText = str_replace( "\n" , " " , $oText );
$oText = str_replace( " " , " " , $oText );
$oText = str_replace( "
" , " " , $oText );
$oText = str_replace( " " , " " , $oText );
$spcCnt = substr_count( $oText , " " );
for ( $i = 1 ; $i <= $spcCnt ; $i++ ) {
$oText = str_replace( " " , " " , $oText );
if ( substr_count( $oText , " " ) == 0 ) { break; }
}
for ( $i = 1 ; $i <= $tagCnt ; $i++ ) {
/* Get Start */
$intA = strpos( $oText , "<" );
/* Get End */
$intB = strpos( $oText , ">" , $intA ) + 1;
/* Get Ignore */
$intC = strpos( $oText , "?>" , $intA ) + 2;
if ( $intC == $intB ) {
$intB = strpos( $oText , ">" , $intC ) + 1;
}
$strC = substr( $oText , $intA , ( $intB - $intA ) );
$oText = str_replace( $strC , " " , $oText ) ;
$oText = str_replace( " " , " " , $oText );
if ( substr_count( $oText , "<" ) == 0 ) { break; }
}
return $oText;
} } /* fRemoveTag */
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** **********
** Function For Sub-String UTF-8
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Parameter Description :
** ========== ========== ========== ========== ==========
** $string Input Text
** $start Start Position
** Default 0
** $sublen Output Text length
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Maintainence History
** ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
** Modify Date :
** Modify By :
** Changes :
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('fSubStrUtf8') ) {
function fSubStrUtf8($string, $start = 0, $sublen ) {
$pa = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xef][\x80-\xbf][\x80-\xbf]|\xf0[\x90-\xbf][\x80-\xbf][\x80-\xbf]|[\xf1-\xf7][\x80-\xbf][\x80-\xbf][\x80-\xbf]/";
preg_match_all($pa, $string, $t_string);
if(count($t_string[0]) - $start > $sublen)
return join('', array_slice($t_string[0], $start, $sublen))."..";
return join('', array_slice($t_string[0], $start, $sublen));
} } /* fSubStrUtf8 */
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** **********
** Function For Generate Password
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Parameter Description :
** ========== ========== ========== ========== ==========
** $iLen Length Of Password
** Default 30
** $iRule Generation Rule
** +1 - Number 0123456789
** +2 - Lower Case Character abcdefghijklmnopqrstuvwxyz
** +4 - Upper Case Character ABCDEFGHIJKLMNOPQRSTUVWXYZ
** +8 - Symbol !@#$%^&*()_+-=[]{}?:;<>,.
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Maintainence History
** ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
** Modify Date :
** Modify By :
** Changes :
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('fGenPwd') ) {
function fGenPwd( $intLen = 30 , $iRule = 15 ) {
$oPwd = "";
$vNum = 0; $vLower = 0; $vUpper = 0; $vSymbol = 0;
/* */
$r = $iRule % 16; $vSymbol = ( $r >= 8 ) ? 1 : 0; $strSymbol = "!@#$%^&*()_+-=[]{}?:;<>,.";
$r = $iRule % 8 ; $vUpper = ( $r >= 4 ) ? 1 : 0; $strUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$r = $iRule % 4 ; $vLower = ( $r >= 2 ) ? 1 : 0; $strLower = "abcdefghijklmnopqrstuvwxyz";
$r = $iRule % 2 ; $vNum = ( $r >= 1 ) ? 1 : 0; $strNumber = "0123456789";
$strAcceptChar .= ( $vNum == 1 ) ? $strNumber : "" ;
$strAcceptChar .= ( $vLower == 1 ) ? $strLower : "" ;
$strAcceptChar .= ( $vUpper == 1 ) ? $strUpper : "" ;
$strAcceptChar .= ( $vSymbol == 1 ) ? $strSymbol : "" ;
/* */
for ( $xxx = 1 ; $xxx <= $intLen ; $xxx++ ) {
$oPwd .= substr( $strAcceptChar , rand( 0 , strlen( $strAcceptChar ) - 1 ) , 1 );
}
/* */
return $oPwd;
} } /* fGenPwd */
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** **********
** Function For include file
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Parameter Description :
** ========== ========== ========== ========== ==========
** $iFileName Include File Location
** $iOnce Is include_once
** Default 1 (Yes)
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Maintainence History
** ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
** Modify Date :
** Modify By :
** Changes :
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('fInc') ) {
function fInc( $iFileName , $iOnce = 1 ) {
$maxLoop = substr_count( $_SERVER['SCRIPT_NAME'] , '/' );
for ( $vLoop = 1 ; $vLoop <= $maxLoop ; $vLoop++ ) {
$vPath = ( $vLoop == 1 ) ? $iFileName : '../'.$vPath ;
if ( file_exists( $vPath ) ) {
if ( dirname( $vPath ) == $vPath ) { break; } /* Check Is File */
if ( $iOnce == 1 ) {
include_once( $vPath );
}
else {
include( $vPath );
}
break;
} /* file_exists $vPath */
} /* for $vLoop */
} } /* fInc */
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** **********
** Function For Check Browser
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Description :
** ========== ========== ========== ========== ==========
** Return Array
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Maintainence History
** ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
** Modify Date :
** Modify By :
** Changes :
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('fGetBrowser') ) {
function fGetBrowser() {
/* */
$userAgent = strtoupper( $_SERVER['HTTP_USER_AGENT'] );
$strBrowser = "Unknown"; $strVersion = "Unknown";
/* */
if ( preg_match( '/MSIE/i' , $userAgent ) )
{ /* Case MSIE */
$strBrowser = "MSIE";
$strBreak1 = ";"; $strBreak2 = " ";
} /* Case MSIE */
else
if ( preg_match( '/IPHONE/i' , $userAgent ) )
{ /* Case iPhone */
$strBrowser = "IPHONE";
$strBreak1 = " "; $strBreak2 = "/";
} /* Case iPhone */
else
if ( preg_match( '/IPAD/i' , $userAgent ) )
{ /* Case iPad */
$strBrowser = "IPAD";
$strBreak1 = " "; $strBreak2 = "/";
} /* Case iPad */
else
if ( preg_match( '/FIREFOX/i' , $userAgent ) )
{ /* Case FireFox */
$strBrowser = "FIREFOX";
$strBreak1 = " "; $strBreak2 = "/";
} /* Case FireFox */
else
if ( preg_match( '/CHROME/i' , $userAgent ) )
{ /* Case Google Chrome */
$strBrowser = "CHROME";
$strBreak1 = " "; $strBreak2 = "/";
} /* Case Google Chrome */
else
if ( preg_match( '/SAFARI/i' , $userAgent ) )
{ /* Case Safari */
$strBrowser = "SAFARI";
$strBreak1 = " "; $strBreak2 = "/";
} /* Case Safari */
else
if ( preg_match( '/OPERA/i' , $userAgent ) )
{ /* Case Opera */
$strBrowser = "OPERA";
$strBreak1 = " "; $strBreak2 = "/";
} /* Case Opera */
/* */
if ( $strVersion == "Unknown" ) {
$aryUserAgent = explode( $strBreak1 , $userAgent );
foreach ( $aryUserAgent as $k => $v ) {
$v = strtoupper( $v );
if ( preg_match( '/VERSION/i' , $v ) ) {
$strVersion = str_replace( 'VERSION/' , '' , $v );
break;
}
if ( preg_match( '/'.$strBrowser.'/i' , $v ) ) {
$strVersion = str_replace( $strBrowser.$strBreak2 , '' , $v );
}
} /* foreach $aryUserAgent */
} /* if $strVersion */
/* */
$vBowr = array( "Browser" => $strBrowser
, "Version" => $strVersion
);
/* */
return $vBowr;
} } /* fGetBrowser */
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** **********
** Function For Encrypt Url ID
** ========== ========== ========== ========== ==========
** Encypt Numeric ID To Look Like MD5 String
** General MD5 String --> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
** 12345678901234567890123456789012
** Numeric ID --> DDDD
** String Lenght Of ID --> L
** Output --> mmmLmmmmmDDDDmmmmmmmmmmmmmmmmmmmmmmmm
** 123 45678 901234567890123456789012
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Parameter Description :
** ========== ========== ========== ========== ==========
** $iText Input String
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Maintainence History
** ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
** Create Date : 2012-4-25
** Created By : Jimmy
** ========== ========== ========== ========== ==========
** Modify Date :
** Modify By :
** Changes :
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* ********** ********** ********** ********** ********** */
if ( !function_exists('enUrlID') ) {
function enUrlID($iText) {
fEncyAddNoise($iText);
} }
if ( !function_exists('fEncyAddNoise') ) {
function fEncyAddNoise($iText) {
$seed = ( rand( 10000 , 99999 ) );
$seed.= '_'.date('Y-m-d H:i:s');
$seed.= '_'.$iText;
$seed.= '_'.( rand( 10000 , 99999 ) );
$seed = md5( $seed );
$Ax1 = $iText;
$oText = substr( $seed , 0 , 3 ).strlen($Ax1).substr( $seed , 3 , 5 ).$Ax1.substr( $seed , 8 , 24 );
return trim( $oText );
} } /* fEncyAddNoise */
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** **********
** Function For Decode Encyption Url ID
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Parameter Description :
** ========== ========== ========== ========== ==========
** $iText Input String
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Maintainence History
** ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
** Create Date : 2012-4-25
** Created By : Jimmy
** ========== ========== ========== ========== ==========
** Modify Date :
** Modify By :
** Changes :
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('deUrlID') ) {
function deUrlID($iText) {
fEncyClrNoise($iText);
} }
if ( !function_exists('fEncyClrNoise') ) {
function fEncyClrNoise($iText) {
$vStartPos = 9;
$vGetLen = substr( $iText , 3 , 1 );
$blnValid = ( strlen( $iText ) >= 16 );
$blnValid = ( $blnValid && is_numeric( $vStartPos ) && $vStartPos > 0 );
$blnValid = ( $blnValid && is_numeric( $vGetLen ) && $vGetLen > 0 );
$oText = ( $blnValid ) ? substr( $iText , $vStartPos , $vGetLen ) : $iText ;
return trim( $oText );
} } /* fEncyClrNoise */
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** **********
** Function For Encrypt MD5 String By Reorder Method
** ========== ========== ========== ========== ==========
** For Increase Security Reorder MD5 String
** Break Down MD5 String To 8 Pieces, And Then Reorder This String Plus Decode Key
** General MD5 String --> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
** 12345678901234567890123456789012
** Break Down MD --> mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
** 1111 2222 3333 4444 5555 6666 7777 8888
** Order Key Break Down To 2 Pieces kkkk KKKK
** Output Look Like MD5 String --> mmmmkkkkmmmmKKKKmmmmmmmmmmmmmmmmmmmmmmmm
** 1234 5678 901234567890123456789012
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Parameter Description :
** ========== ========== ========== ========== ==========
** $iText Input String
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
/* Maintainence History
** ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
** Create Date : 2012-4-25
** Created By : Jimmy
** ========== ========== ========== ========== ==========
** Modify Date :
** Modify By :
** Changes :
** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('md5e') ) {
function md5e($iText , $iKey = "") {
fEncyMD5ReOen($iText,$iKey);
} }
if ( !function_exists('fEncyMD5ReOen') ) {
function fEncyMD5ReOen($iText , $iKey = "") {
/* ********** ********** ********** ********** ********** */
$debug = false;
$key1 = ""; $key2 = ""; $o1 = ""; $o2 = ""; $o3 = ""; $aryRnd = array(); $aryText = array(); $aryKey = array();
$md5Text = md5( $iText );
/* ********** ********** ********** ********** ********** */
$intPos = 0;
for ( $i = 1 ; $i <= 8 ; $i++ )
{ /* $i */
if ( $iKey == "" )
{ /* No Entry Key */
$aryRnd[$i] = rand( 10001000 , 9999999999 );
} /* No Entry Key */
else
{ /* Entry Key */
$intPosKey = $i - 1;
$aryRnd[$i] = 9 - substr( $iKey , $intPosKey , 1 );
} /* Entry Key */
$aryText[$i] = substr( $md5Text , $intPos , 4 );
$intPos+= 4;
} /* $i */
/* ********** ********** ********** ********** ********** */
if ( $debug )
{ /* $debug */
echo $md5Text;
echo '
'.$aryText[1].'-'.$aryText[2].'-'.$aryText[3].'-'.$aryText[4].'-'.$aryText[5].'-'.$aryText[6].'-'.$aryText[7].'-'.$aryText[8];
} /* $debug */
/* ********** ********** ********** ********** ********** */
for ( $i = 1 ; $i <= 8 ; $i++ )
{ /* $i */
$maxRnd = 0; $maxKey = 0;
for ( $j = 1 ; $j <= 8 ; $j++ )
{ /* $j */
if ( $aryRnd[$j] > $maxRnd )
{
$maxRnd = $aryRnd[$j];
$maxKey = $j;
}
} /* $j */
$aryRnd[$maxKey] = 0;
/* */
if ( $i <= 4 ) {
$key1.= $maxKey;
}
else {
$key2.= $maxKey;
}
/* */
if ( $i == 1 ) {
$o1 = $aryText[$maxKey];
}
elseif ( $i == 2 ) {
$o2 = $aryText[$maxKey];
}
else {
$o3.= $aryText[$maxKey];
}
} /* $i */
if ( $iKey == "" )
{ /* No Entry Key */
$oText = $o1.$key1.$o2.$key2.$o3;
} /* No Entry Key */
else
{ /* Entry Key */
$oText = $o1.$o2.$o3;
} /* Entry Key */
if ( $debug )
{ /* $debug */
echo '
'.$key1.'-'.$key2;
echo '
'.$aryText[substr($key1,0,1)].'-'.$aryText[substr($key1,1,1)].'-'.$aryText[substr($key1,2,1)].'-'.$aryText[substr($key1,3,1)];
echo '-'.$aryText[substr($key2,0,1)].'-'.$aryText[substr($key2,1,1)].'-'.$aryText[substr($key2,2,1)].'-'.$aryText[substr($key2,3,1)];
} /* $debug */
/* ********** ********** ********** ********** ********** */
return trim( $oText );
/* ********** ********** ********** ********** ********** */
} } /* fEncyMD5ReOen */
if ( !function_exists('md5en') ) {
function md5en($iText , $iKey = "") {
return fEncyMD5ReOen($iText,$iKey);
} }
/*** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('md5de') ) {
function md5de($iText , $iKey = "") {
return fEncyMD5ReOde($iText,$iKey);
} }
if ( !function_exists('fEncyMD5ReOde') ) {
function fEncyMD5ReOde($iText , $iKey = "") {
$debug = false;
$oText = "";
$aryText = array(); $aryKey = array(); $aryNew = array();
$intPos = 0;
for ( $i = 1 ; $i <= 8 ; $i++ )
{ /* $i */
$aryText[$i] = substr( $iText , $intPos , 4 );
$intPos+= 4;
if ( $i == 1 || $i == 2 )
{ /* $i == 1 || 3*/
$jForFrom = ( $i == 1 ) ? 1 : 5;
$jForTo = ( $i == 1 ) ? 4 : 8;
for ( $j = $jForFrom ; $j <= $jForTo ; $j++ )
{ /* $j */
if ( $iKey == "" )
{ /* No Key Entry */
$aryKey[$j] = substr( $iText , $intPos , 1 );
$intPos+= 1;
} /* No Key Entry */
else
{ /* Key Entry */
$intPosKey = $j - 1;
$aryKey[$j] = substr( $iKey , $intPosKey , 1 );
} /* Key Entry */
} /* $j */
} /* $i == 1 || 3*/
} /* $i */
if ( $debug )
{ /* $debug */
echo '
'.$aryText[1].'-'.$aryText[2].'-'.$aryText[3].'-'.$aryText[4].'-'.$aryText[5].'-'.$aryText[6].'-'.$aryText[7].'-'.$aryText[8];
echo '
'.$aryKey[1].'-'.$aryKey[2].'-'.$aryKey[3].'-'.$aryKey[4].'-'.$aryKey[5].'-'.$aryKey[6].'-'.$aryKey[7].'-'.$aryKey[8];
} /* $debug */
$oText = "";
for ( $i = 1 ; $i <= 8 ; $i++ )
{ /* $i */
$aryNew[$aryKey[$i]] = $aryText[$i];
} /* $i */
if ( $debug )
{ /* $debug */
echo '
'.$aryNew[1].'-'.$aryNew[2].'-'.$aryNew[3].'-'.$aryNew[4].'-'.$aryNew[5].'-'.$aryNew[6].'-'.$aryNew[7].'-'.$aryNew[8];
} /* $debug */
$oText = $aryNew[1].$aryNew[2].$aryNew[3].$aryNew[4].$aryNew[5].$aryNew[6].$aryNew[7].$aryNew[8];
return trim( $oText );
} } /* fEncyMD5ReOde */
/* ********** ********** Camby @ 2012-04 ********** ********** */
if (!function_exists('json_encode')) {
function json_encode($a=false) {
if (is_null($a)) return 'null';
if ($a === false) return 'false';
if ($a === true) return 'true';
if (is_scalar($a)) {
if (is_float($a)) {
// Always use "." for floats.
return floatval(str_replace(",", ".", strval($a)));
}
if (is_string($a)) {
static $jsonReplaces = array(array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'));
return '"' . str_replace($jsonReplaces[0], $jsonReplaces[1], $a) . '"';
} else {
return $a;
}
}
$isList = true;
for ($i = 0, reset($a); $i < count($a); $i++, next($a)) {
if (key($a) !== $i) {
$isList = false;
break;
}
}
$result = array();
if ($isList) {
foreach ($a as $v) $result[] = json_encode($v);
return '[' . join(',', $result) . ']';
} else {
foreach ($a as $k => $v) $result[] = json_encode($k).':'.json_encode($v);
return '{' . join(',', $result) . '}';
}
}
}
/* ********** ********** Camby @ 2012-01 ********** ********** */
if ( !function_exists('genRandomString') ) {
function genRandomString($length=8,$no=1,$a=1,$A=1,$o=0) {
$characters = '';
if($no==1) {$characters .= '0123456789';}
if($a==1) {$characters .= 'abcdefghijklmnopqrstuvwxyz';}
if($A==1) {$characters .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';}
if($o==1) {$characters .= '~!@#$%^&*()_-+=?.,:;';}
$string ='';
if ( strlen($characters) > 0 )
{ for ($p = 0; $p < $length; $p++) {
$string .= $characters[mt_rand(0, strlen($characters) - 1)];
} }
return $string;
}
}
/* ********** ********** Camby @ 2011-12 ********** ********** */
if ( !function_exists('echoarray') ) {
function echoarray($ary) {
echo '';
foreach($ary as $key => $a) {
if(is_array($a)) {
echo '| '.$key.' => |
| ';
echoarray($a);
echo ' |
';
} else {
echo '| '.$key.' => '.$a.' |
';
}
}
echo '
';
}
}
/* ********** ********** Camby @ 2011-12 ********** ********** */
if ( !function_exists('getDirImage') ) {
function getDirImage($imageDir) {
$imageArr = array();
$f = opendir($imageDir);
while($files = readdir($f)) {
if ($files != '..' && $files != '.' && preg_match("/(jpg|gif|png)$/i", $files)) {
$imageArr[] = $files;
}
}
closedir($f);
return $imageArr;
}
}
/** ********** ********** Camby @ 2012-05 ********** ********** */
if ( !function_exists('ResizeImg') ) {
function ResizeImg($opath,$npath,$newwidth,$newheight = 0,$haveWatermark = false) {
// Get new sizes
$l = getimagesize($opath);
$width = $l[0];
$height = $l[1];
$type = $l['mime'];
if($newwidth && $width>$newwidth) {
$ratio = $newwidth / $width;
$resizeWidth = $newwidth;
$resizeHeight = round($height * $ratio);
}
if($newheight && $resizeHeight>$newheight) {
$ratio = $newheight / $height;
$resizeHeight = $newheight;
$resizeWidth = round($width * $ratio);
}
if ( $resizeHeight == 0 )
{ $resizeHeight = $height;
$resizeWidth = $width;
}
if($resizeHeight > 0)
{
ob_start();
echo "Image '$opath' cannot resize to $resizeWidth * $resizeHeight.";
// Load
$thumb = imagecreatetruecolor($resizeWidth, $resizeHeight);
//PreWrite Error
//$f = @fopen('../../cache/imageResizeError.txt','w');
//fwrite($f,"Image '$opath' cannot resize.");
switch($type)
{
case "image/gif":
$source=imagecreatefromgif($opath);
break;
case "image/pjpeg":
case "image/jpeg":
case "image/jpg":
$source=imagecreatefromjpeg($opath);
break;
case "image/png":
case "image/x-png":
$source=imagecreatefrompng($opath);
// $white = imagecolorallocate($thumb, 255, 255, 255);
// imagefilledrectangle($thumb, 0, 0, $resizeWidth, $resizeHeight, $white);
// imagecopy($thumb, $source, 0, 0, 0, 0, $resizeWidth, $resizeHeight);
$RtVal = imagealphablending($thumb, false);
$RtVal = imagesavealpha($thumb,true);
$transparent = imagecolorallocatealpha($thumb, 255, 255, 255, 127);
$RtVal = imagefilledrectangle($thumb, 0, 0, $resizeWidth, $resizeHeight, $transparent);
break;
}
// Resize
imagecopyresampled($thumb, $source, 0, 0, 0, 0, $resizeWidth, $resizeHeight, $width, $height);
if ($haveWatermark)
{
// WaterMark with resized image
// Image
$watermark = '../images/water_mark/logo.png';
$watermark = imagecreatefrompng($watermark);
$margin_left = 0;
$margin_top = 0;
$opacity = 100;
imagecopymerge($thumb, $watermark, $margin_left, $margin_top, 0, 0, imagesx($watermark), imagesy($watermark), $opacity);
// Text
$wx = imagesx($thumb);
$wy = imagesy($thumb);
$watermarktext="chungsen.com.hk";
$font="../images/water_mark/fonts/arial.ttf";
$fontsize="8";
$white = imagecolorallocate($thumb, 255, 255, 255);
imagettftext($thumb, $fontsize, 0, $wx/8, $wy/2, $white, $font, $watermarktext);
// WaterMark with source
// Image
$source=imagecreatefromjpeg($opath);
$margin_left = 0;
$margin_top = 0;
imagecopymerge($source, $watermark, $margin_left, $margin_top, 0, 0, imagesx($watermark), imagesy($watermark), $opacity);
// Text
$wx = imagesx($source);
$wy = imagesy($source);
$watermarktext="chungsen.com.hk";
$font="../images/water_mark/fonts/arial.ttf";
$fontsize="20";
$white = imagecolorallocate($source, 255, 255, 255);
imagettftext($source, $fontsize, 0, $wx/3, $wy/2, $white, $font, $watermarktext);
// Output
echo 1;
switch($type) {
case "image/gif":
imagegif($source,$opath);
break;
case "image/pjpeg":
case "image/jpeg":
case "image/jpg":
imagejpeg($source,$opath,100);
break;
case "image/png":
case "image/x-png":
imagepng($source,$opath);
break;
}
}
// Output
// echo 1;
switch($type) {
case "image/gif":
imagegif($thumb,$npath);
break;
case "image/pjpeg":
case "image/jpeg":
case "image/jpg":
if ( function_exists('exif_read_data') )
{
$aryExif = exif_read_data($opath);
if ( isset($aryExif['Orientation']) )
{ switch($aryExif['Orientation'])
{
case 1: // Normal ^ //
break;
//
case 3: // Upside-Down V //
$thumb = imagerotate($thumb, 180, 0);
break;
//
case 6: // Rotate Left < //
$thumb = imagerotate($thumb, -90, 0);
break;
//
case 8: // Rotate Right > //
$thumb = imagerotate($thumb, 90, 0);
break;
} }
}
imagejpeg($thumb,$npath,100);
break;
case "image/png":
case "image/x-png":
imagepng($thumb,$npath);
break;
}
ob_clean();
//Delete Error
//$f = @fopen('../../cache/imageResizeError.txt','w');
}
}
}
/** ********** ********** Jason @ 2016-04 ********** ********** */
if ( !function_exists('ResizeImgWithCrop') ) {
function ResizeImgWithCrop($opath,$npath,$newwidth,$newheight = 0,$image_1) {
// Get new sizes
$l = getimagesize($opath);
$width = $l[0];
$height = $l[1];
$type = $l['mime'];
if ($image_1 != '')
{
$cropped_dimen_1 = explode(',', $image_1);
$newwidth = $cropped_dimen_1[4];
$newheight = $cropped_dimen_1[5];
}
if($newwidth && $width>$newwidth) {
$ratio = $newwidth / $width;
$resizeWidth = $newwidth;
$resizeHeight = round($height * $ratio);
}
if($newheight && $resizeHeight>$newheight) {
$ratio = $newheight / $height;
$resizeHeight = $newheight;
$resizeWidth = round($width * $ratio);
}
if($resizeHeight > 0)
{
ob_start();
echo "Image '$opath' cannot resize to $resizeWidth * $resizeHeight.";
// Load
$thumb = imagecreatetruecolor($resizeWidth, $resizeHeight);
//PreWrite Error
//$f = @fopen('../../cache/imageResizeError.txt','w');
//fwrite($f,"Image '$opath' cannot resize.");
switch($type)
{
case "image/gif":
$source=imagecreatefromgif($opath);
break;
case "image/pjpeg":
case "image/jpeg":
case "image/jpg":
$source=imagecreatefromjpeg($opath);
break;
case "image/png":
case "image/x-png":
$source=imagecreatefrompng($opath);
// $white = imagecolorallocate($thumb, 255, 255, 255);
// imagefilledrectangle($thumb, 0, 0, $resizeWidth, $resizeHeight, $white);
// imagecopy($thumb, $source, 0, 0, 0, 0, $resizeWidth, $resizeHeight);
$RtVal = imagealphablending($thumb, false);
$RtVal = imagesavealpha($thumb,true);
$transparent = imagecolorallocatealpha($thumb, 255, 255, 255, 127);
$RtVal = imagefilledrectangle($thumb, 0, 0, $resizeWidth, $resizeHeight, $transparent);
break;
}
// Resize
imagecopyresampled($thumb, $source, 0, 0, $cropped_dimen_1[0], $cropped_dimen_1[1], $cropped_dimen_1[4], $cropped_dimen_1[5], $cropped_dimen_1[4], $cropped_dimen_1[5]);
// Output
// echo 1;
switch($type) {
case "image/gif":
imagegif($thumb,$npath);
break;
case "image/pjpeg":
case "image/jpeg":
case "image/jpg":
if ( function_exists('exif_read_data') )
{
$aryExif = exif_read_data($opath);
if ( isset($aryExif['Orientation']) )
{ switch($aryExif['Orientation'])
{
case 1: // Normal ^ //
break;
//
case 3: // Upside-Down V //
$thumb = imagerotate($thumb, 180, 0);
break;
//
case 6: // Rotate Left < //
$thumb = imagerotate($thumb, -90, 0);
break;
//
case 8: // Rotate Right > //
$thumb = imagerotate($thumb, 90, 0);
break;
} }
}
imagejpeg($thumb,$npath,100);
break;
case "image/png":
case "image/x-png":
imagepng($thumb,$npath);
break;
}
ob_clean();
//Delete Error
//$f = @fopen('../../cache/imageResizeError.txt','w');
}
}
}
/* ********** ********** Camby @ 2012-05 ********** ********** */
if ( !function_exists('img_path') ) {
function img_path($path,$resize='thumb',$type='path') {
// $imgname = end(explode('/',$path));
$aryA = explode('/',$path);
$imgname = end($aryA);
if($type=='name') {
return $resize.'_'.$imgname;
} else {
return str_replace($imgname,$resize.'/'.$resize.'_'.$imgname,$path);
}
}
}
/**************************** Camby **********************************/
if ( !function_exists('classifyarray') ) {
function classifyarray($thearray, $type='makearray') {
if($type=='makearray') {//-------------將 statment 變成 array statment (加 ' 號)
$thearray = explode(',',$thearray);
for($i=0;$i $v) {
$page_name .=$k.'='.$v.'&';
}
$prev = $page-1;
$next = $page+1;
if($prev!=0)
echo "<";
for($i = 1; $i <= $page_cnt; $i++){
if($i==$page)
echo "$i
";
else
echo "$i
";
}
if($next<=$page_cnt)
echo ">";
}
}
/* ********** ********** Camby @ 2012-01, Last Modified @ 2013-07 ********** ********** */
if( !function_exists('multipage') ) {
function multipage($total, $cpp, $thispage, $wlink, $withnext = array('< Prev','Next >')/*array('< Prev','Next >')*/, $varname = '', $tab = false, $ajax = false, $cutpage = '20') {
//varname = passed page name (page, page2, page3,...)
//tab = passed tab name
$multipage = '';
$totalpage = ceil($total / $cpp);
if($totalpage>1) {
if($ajax) {
if($cutpage > 5 && $totalpage > $cutpage) {
$showpage = $cutpage-3;
for($i=$showpage;$i>1;$i = $i-2) {
$deduct++;
$plus++;
}
if($showpage>0) {$plus++;}
$startpage = $thispage - $deduct;
$endpage = $thispage + $plus;
if($startpage<1) {
$startpage = 1;
$endpage = $startpage + $plus + $deduct;
} elseif($endpage>$totalpage) {
$endpage = $totalpage;
$startpage = $endpage - $plus - $deduct;
}
for($i=$startpage;$i<=$endpage;$i++) {
$wlink = 'javascript:'.str_replace('ajaxpage',$i,$ajax);
if($thispage==$i) {
$multipage .= '
'.$i.'';
} else {
$multipage .= '
'.$i.'';
}
}
if($startpage-1>1) {
$wlink = 'javascript:'.str_replace('ajaxpage','1',$ajax);
$multipage = '1..';
}
if($endpage+1<$totalpage) {
$wlink = 'javascript:'.str_replace('ajaxpage',$totalpage,$ajax);
$multipage .= ''.$totalpage.'';
}
} else {
for($i=1;$i<=$totalpage;$i++) {
$wlink = 'javascript:'.str_replace('ajaxpage',$i,$ajax);
if($thispage==$i) {
$multipage .= '
'.$i.'';
} else {
$multipage .= '
'.$i.'';
}
}
}
} else {
/**/
if($tab){$target = "#".$tab;}
/**/
if(strpos($wlink,'?')) {
if($varname)
{
$wlink .= '&'.$varname.'=';
}
else
{
$wlink .= '&page=';
}
} else {
if($varname)
{
$wlink .= '?'.$varname.'=';
}
else
{
$wlink .= '?page=';
}
}
if($cutpage > 5 && $totalpage > $cutpage) {
$showpage = $cutpage-3;
for($i=$showpage;$i>1;$i = $i-2) {
$deduct++;
$plus++;
}
if($showpage>0) {$plus++;}
$startpage = $thispage - $deduct;
$endpage = $thispage + $plus;
if($startpage<1) {
$startpage = 1;
$endpage = $startpage + $plus + $deduct;
} elseif($endpage>$totalpage) {
$endpage = $totalpage;
$startpage = $endpage - $plus - $deduct;
}
for($i=$startpage;$i<=$endpage;$i++) {
if($thispage==$i) {
$multipage .= '
'.$i.'';
} else {
$multipage .= '
'.$i.'';
}
}
if($startpage>1) {
$multipage = '1..'.$multipage;
}
if($endpage<$totalpage) {
$multipage .= '..'.$totalpage.'';
}
} else {
for($i=1;$i<=$totalpage;$i++) {
if($thispage==$i) {
$multipage .= '
'.$i.'';
} else {
$multipage .= '
'.$i.'';
}
}
}
}
if($withnext) {
if($ajax) {
$back = $thispage-1;
$wlink = 'javascript:'.str_replace('ajaxpage',$back,$ajax);
$back = $back > 0 ? '
'.$withnext[0].'' : '
'.$withnext[0].'';
$next = $thispage+1;
$wlink = 'javascript:'.str_replace('ajaxpage',$next,$ajax);
$next = $next <= $totalpage ? '
'.$withnext[1].'' : '
'.$withnext[1].'';
$multipage = $back.$multipage.$next;
} else {
$back = $thispage-1;
$back = $back > 0 ? '
'.$withnext[0].'' : '
'.$withnext[0].'';
$next = $thispage+1;
$next = $next <= $totalpage ? '
'.$withnext[1].'' : '
'.$withnext[1].'';
$multipage = $back.$multipage.$next;
}
}
$multipage = ''.$multipage.'
';
}
return $multipage;
}
}
if( !function_exists('multipage_news') ) {
function multipage_news($total, $cpp, $thispage, $wlink, $withnext = array('< Prev','Next >')/*array('< Prev','Next >')*/, $varname = '', $tab = false, $ajax = false, $cutpage = '20') {
//varname = passed page name (page, page2, page3,...)
//tab = passed tab name
$totalpage = ceil($total / $cpp);
if($totalpage>1) {
if($ajax) {
if($cutpage > 5 && $totalpage > $cutpage) {
$showpage = $cutpage-3;
for($i=$showpage;$i>1;$i = $i-2) {
$deduct++;
$plus++;
}
if($showpage>0) {$plus++;}
$startpage = $thispage - $deduct;
$endpage = $thispage + $plus;
if($startpage<1) {
$startpage = 1;
$endpage = $startpage + $plus + $deduct;
} elseif($endpage>$totalpage) {
$endpage = $totalpage;
$startpage = $endpage - $plus - $deduct;
}
for($i=$startpage;$i<=$endpage;$i++) {
$wlink = 'javascript:'.str_replace('ajaxpage',$i,$ajax);
if($thispage==$i) {
$multipage .= '
'.$i.'';
} else {
$multipage .= '
'.$i.'';
}
}
if($startpage-1>1) {
$wlink = 'javascript:'.str_replace('ajaxpage','1',$ajax);
$multipage = '1..';
}
if($endpage+1<$totalpage) {
$wlink = 'javascript:'.str_replace('ajaxpage',$totalpage,$ajax);
$multipage .= ''.$totalpage.'';
}
} else {
for($i=1;$i<=$totalpage;$i++) {
$wlink = 'javascript:'.str_replace('ajaxpage',$i,$ajax);
if($thispage==$i) {
$multipage .= '
'.$i.'';
} else {
$multipage .= '
'.$i.'';
}
}
}
} else {
/**/
if($tab){$target = "#".$tab;}
/**/
if(strpos($wlink,'?')) {
if($varname)
{
$wlink .= '&'.$varname.'=';
}
else
{
$wlink .= '&page=';
}
} else {
if($varname)
{
$wlink .= '&'.$varname.'=';
}
else
{
$wlink .= '&page=';
}
}
if($cutpage > 5 && $totalpage > $cutpage) {
$showpage = $cutpage-3;
for($i=$showpage;$i>1;$i = $i-2) {
$deduct++;
$plus++;
}
if($showpage>0) {$plus++;}
$startpage = $thispage - $deduct;
$endpage = $thispage + $plus;
if($startpage<1) {
$startpage = 1;
$endpage = $startpage + $plus + $deduct;
} elseif($endpage>$totalpage) {
$endpage = $totalpage;
$startpage = $endpage - $plus - $deduct;
}
for($i=$startpage;$i<=$endpage;$i++) {
if($thispage==$i) {
$multipage .= '
'.$i.'';
} else {
$multipage .= '
'.$i.'';
}
}
if($startpage>1) {
$multipage = '1..'.$multipage;
}
if($endpage<$totalpage) {
$multipage .= '..'.$totalpage.'';
}
} else {
for($i=1;$i<=$totalpage;$i++) {
if($thispage==$i) {
$multipage .= '
'.$i.'';
} else {
$multipage .= '
'.$i.'';
}
}
}
}
if($withnext) {
if($ajax) {
$back = $thispage-1;
$wlink = 'javascript:'.str_replace('ajaxpage',$back,$ajax);
$back = $back > 0 ? '
'.$withnext[0].'' : '
'.$withnext[0].'';
$next = $thispage+1;
$wlink = 'javascript:'.str_replace('ajaxpage',$next,$ajax);
$next = $next <= $totalpage ? '
'.$withnext[1].'' : '
'.$withnext[1].'';
$multipage = $back.$multipage.$next;
} else {
$back = $thispage-1;
$back = $back > 0 ? '
'.$withnext[0].'' : '
'.$withnext[0].'';
$next = $thispage+1;
$next = $next <= $totalpage ? '
'.$withnext[1].'' : '
'.$withnext[1].'';
$multipage = $back.$multipage.$next;
}
}
$multipage = ''.$multipage.'
';
}
return $multipage;
}
}
if( !function_exists('multipage_gallery') ) {
function multipage_gallery($total, $cpp, $thispage, $wlink, $withnext = array('< Prev','Next >')/*array('< Prev','Next >')*/, $varname = '', $tab = false, $ajax = false, $cutpage = '20') {
//varname = passed page name (page, page2, page3,...)
//tab = passed tab name
$totalpage = ceil($total / $cpp);
if($totalpage>1) {
if($ajax) {
if($cutpage > 5 && $totalpage > $cutpage) {
$showpage = $cutpage-3;
for($i=$showpage;$i>1;$i = $i-2) {
$deduct++;
$plus++;
}
if($showpage>0) {$plus++;}
$startpage = $thispage - $deduct;
$endpage = $thispage + $plus;
if($startpage<1) {
$startpage = 1;
$endpage = $startpage + $plus + $deduct;
} elseif($endpage>$totalpage) {
$endpage = $totalpage;
$startpage = $endpage - $plus - $deduct;
}
for($i=$startpage;$i<=$endpage;$i++) {
$wlink = 'javascript:'.str_replace('ajaxpage',$i,$ajax);
if($thispage==$i) {
$multipage .= '
'.$i.'';
} else {
$multipage .= '
'.$i.'';
}
}
if($startpage-1>1) {
$wlink = 'javascript:'.str_replace('ajaxpage','1',$ajax);
$multipage = '1..';
}
if($endpage+1<$totalpage) {
$wlink = 'javascript:'.str_replace('ajaxpage',$totalpage,$ajax);
$multipage .= ''.$totalpage.'';
}
} else {
for($i=1;$i<=$totalpage;$i++) {
$wlink = 'javascript:'.str_replace('ajaxpage',$i,$ajax);
if($thispage==$i) {
$multipage .= '
'.$i.'';
} else {
$multipage .= '
'.$i.'';
}
}
}
} else {
/**/
if($tab){$target = "#".$tab;}
/**/
if(strpos($wlink,'?')) {
if($varname)
{
$wlink .= '&'.$varname.'=';
}
else
{
$wlink .= '&page=';
}
} else {
if($varname)
{
$wlink .= '&'.$varname.'=';
}
else
{
$wlink .= '&page=';
}
}
if($cutpage > 5 && $totalpage > $cutpage) {
$showpage = $cutpage-3;
for($i=$showpage;$i>1;$i = $i-2) {
$deduct++;
$plus++;
}
if($showpage>0) {$plus++;}
$startpage = $thispage - $deduct;
$endpage = $thispage + $plus;
if($startpage<1) {
$startpage = 1;
$endpage = $startpage + $plus + $deduct;
} elseif($endpage>$totalpage) {
$endpage = $totalpage;
$startpage = $endpage - $plus - $deduct;
}
for($i=$startpage;$i<=$endpage;$i++) {
if($thispage==$i) {
$multipage .= '
'.$i.'';
} else {
$multipage .= '
'.$i.'';
}
}
if($startpage>1) {
$multipage = '1..'.$multipage;
}
if($endpage<$totalpage) {
$multipage .= '..'.$totalpage.'';
}
} else {
for($i=1;$i<=$totalpage;$i++) {
if($thispage==$i) {
$multipage .= '
'.$i.'';
} else {
$multipage .= '
'.$i.'';
}
}
}
}
if($withnext) {
if($ajax) {
$back = $thispage-1;
$wlink = 'javascript:'.str_replace('ajaxpage',$back,$ajax);
$back = $back > 0 ? '
'.$withnext[0].'' : '
'.$withnext[0].'';
$next = $thispage+1;
$wlink = 'javascript:'.str_replace('ajaxpage',$next,$ajax);
$next = $next <= $totalpage ? '
'.$withnext[1].'' : '
'.$withnext[1].'';
$multipage = $back.$multipage.$next;
} else {
$back = $thispage-1;
$back = $back > 0 ? '
'.$withnext[0].'' : '
'.$withnext[0].'';
$next = $thispage+1;
$next = $next <= $totalpage ? '
'.$withnext[1].'' : '
'.$withnext[1].'';
$multipage = $back.$multipage.$next;
}
}
$multipage = ''.$multipage.'
';
}
return $multipage;
}
}
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('resizeThumbnailImage') ) {
function resizeThumbnailImage($thumb_image_name, $image, $width, $height, $start_width, $start_height, $scale = 1){
list($imagewidth, $imageheight, $imageType) = getimagesize($image);
$imageType = image_type_to_mime_type($imageType);
$newImageWidth = ceil($width * $scale);
$newImageHeight = ceil($height * $scale);
$newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);
switch($imageType) {
case "image/gif":
$source=imagecreatefromgif($image);
break;
case "image/pjpeg":
case "image/jpeg":
case "image/jpg":
$source=imagecreatefromjpeg($image);
break;
case "image/png":
case "image/x-png":
$source=imagecreatefrompng($image);
break;
}
imagecopyresampled($newImage,$source,0,0,$start_width,$start_height,$newImageWidth,$newImageHeight,$width,$height);
switch($imageType) {
case "image/gif":
imagegif($newImage,$thumb_image_name);
break;
case "image/pjpeg":
case "image/jpeg":
case "image/jpg":
imagejpeg($newImage,$thumb_image_name,100);
break;
case "image/png":
case "image/x-png":
imagepng($newImage,$thumb_image_name);
break;
}
chmod($thumb_image_name, 0777);
return $thumb_image_name;
}
}
/* ********** ********** ********** Camby @ 2012-07 ********** ********** ********** ********** ********** */
if ( !function_exists('jsMsg') )
{ function jsMsg($msg,$window='parent') {
echo ''; exit;
} }
/* ********** ********** ********** Camby @ 2012-07 ********** ********** ********** ********** ********** */
if ( !function_exists('jsCMsg') )
{ function jsCMsg($msg,$location,$window='parent') {
echo ''; exit;
} }
/* ********** ********** ********** Camby @ 2012-07 ********** ********** ********** ********** ********** */
if ( !function_exists('jsReload') )
{ function jsReload($window='parent') {
echo ''; exit;
} }
/* ********** ********** ********** Camby @ 2012-07 ********** ********** ********** ********** ********** */
if ( !function_exists('jsURL') )
{ function jsURL($url,$window='parent') {
echo ''; exit;
} }
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('fAddItemSQL') )
{ function fAddItemSQL($iFldName , $iValue , $iIsText = 0 , $iAllowNULL = 1 ) {
$oText = trim( fClrHeadChr( $iValue ) );
if ( $oText == '' && $iAllowNULL == 1 )
{
$oText = " , `".trim( $iFldName )."` = NULL ";
}
else
{
$oText = ( $iIsText == 1 ) ? fBig5ToUtf8( $oText ) : $oText ;
$oText = " , `".trim( $iFldName )."` = '".fBoxSQL( trim( $oText ) )."' ";
}
return ( $oText );
} }
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('fClrHeadChr') )
{ function fClrHeadChr($iText) {
$oText = $iText;
if ( substr( trim( $iText ) , 0 , 1 ) == "'" )
{
$vLen = strlen( trim( $iText ) ) - 1 ;
$oText = substr( trim( $iText ) , 1 , $vLen );
}
return ( trim( $oText ) );
} }
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('fCheckDateCSV') )
{ function fCheckDateCSV($iDate) {
$oDate = '';
$aryA = explode( ' ' , fClrHeadChr( $iDate ) );
$aryB = explode( '-' , $aryA[0] );
$vY = '' ; $vM = ''; $vD = '';
if ( sizeof( $aryB ) == 3 )
{
for ( $i = 1 ; $i <= 3 ; $i++ ) { if ( substr( $aryB[$i] , 0 , 1 ) == '0' ) { $aryB[$i] = substr( $aryB[$i] , 1 , 2 ); } }
if ( checkdate( $aryB[1] , $aryB[2] , $aryB[0] ) )
{
$vM = $aryB[1] ; $vD = $aryB[2] ; $vY = $aryB[0] ;
}
}
else
{
$aryB = explode( '/' , $aryA[0] );
if ( sizeof( $aryB ) == 3 )
{
for ( $i = 1 ; $i <= 3 ; $i++ ) { if ( substr( $aryB[$i] , 0 , 1 ) == '0' ) { $aryB[$i] = substr( $aryB[$i] , 1 , 2 ); } }
if ( checkdate( $aryB[1] , $aryB[2] , $aryB[0] ) ) /* Y/M/D */
{
$vM = $aryB[1] ; $vD = $aryB[2] ; $vY = $aryB[0] ;
}
elseif ( checkdate( $aryB[1] , $aryB[0] , $aryB[2] ) ) /* D/M/Y */
{
$vM = $aryB[1] ; $vD = $aryB[0] ; $vY = $aryB[2] ;
}
elseif ( checkdate( $aryB[0] , $aryB[1] , $aryB[2] ) ) /* M/D/Y */
{
$vM = $aryB[0] ; $vD = $aryB[1] ; $vY = $aryB[2] ;
}
}
}
if ( $vY != '' && $vM != '' && $vD != '' )
{
$oDate = $vY.'-'.str_pad( $vM , 2 , '0' , STR_PAD_LEFT ).'-'.str_pad( $vD , 2 , '0' , STR_PAD_LEFT );
}
return($oDate);
} }
/* ********** ********** ********** Camby @ 2012-07 ********** ********** ********** ********** ********** */
if ( !function_exists('tuneYouTube') ) {
function tuneYouTube($url,$type='url') {
$uid = str_replace('http://www.youtube.com/embed/','',$url);
$uid = str_replace('http://www.youtube.com/watch?v=','',$uid);
$uid = str_replace('http://www.youtube.com/v/','',$uid);
$uid = str_replace('?fs=1&autoplay=1','',$uid);
$uid = str_replace('&autoplay=1&autoplay=1','',$uid);
$uid = str_replace('?fs=1','',$uid);
$uid = current(explode('&',$uid));
return $type=='url' ? 'http://www.youtube.com/embed/'.$uid : $uid;
}
}
/* ********** ********** ********** Camby @ 2012-08 ********** ********** ********** ********** ********** */
if ( !function_exists('trimUrl') ) {
function trimUrl($var,$url = '') {
if(!$url) { $url = $_SERVER['REQUEST_URI']; }
if(!is_array($var)) {
$var = array($var);
}
foreach($var as $v) {
$w = explode($v,$url);
$ww = explode('&',$w[1]);
$url = $w[0].$ww[1];
}
while(strstr($url,'&&') && $i<100) {
$url = str_replace('&&','&',$url);
$i++;
}
if(substr($url,strlen($url)-1,1)=='&') {
$url = substr($url,0,strlen($uel)-1);
}
if(!strstr($url,'?')) { $url = $url.'?'; }
return $url;
}
}
/* ********** ********** ********** Camby @ 2013-07 ********** ********** ********** ********** ********** */
if ( !function_exists('echoLoop') ) {
function echoLoop($ary) {
$list = '';
foreach($ary as $a) { $list .= $a; }
return $list;
}
}
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if (!function_exists('watermark')) {
function watermark($source, $watermark, $output, $margin_right, $margin_bottom, $opacity) {
$watermark = imagecreatefrompng($watermark);
$gis = getimagesize($source);
$type = $gis['mime'];
switch($type) {
case "image/gif":
$source = imagecreatefromgif($source);
break;
case "image/pjpeg":
case "image/jpeg":
case "image/jpg":
$source = imagecreatefromjpeg($source);
break;
case "image/png":
case "image/x-png":
$source = imagecreatefrompng($source);
break;
}
$wx = imagesx($watermark);
$wy = imagesy($watermark);
imagecopymerge($source, $watermark, imagesx($source) - $wx - $margin_right, imagesy($source) - $wy - $margin_bottom, 0, 0, imagesx($watermark), imagesy($watermark), $opacity);
imagejpeg($source, $output, 100);
imagedestroy($source);
}
}
/* ********** ********** ********** Multi Category ********** ********** ********** ********** ********** */
if ( !function_exists('_findChildren') ) {
function _findChildren($list,$p_id,$dbPrefix="cate"){
$r = array();
foreach($list as $id=>$item){
if($item[$dbPrefix.'_pid'] == $p_id) {
$length = count($r);
$r[$length] = $item;
if($t = _findChildren($list, $item[$dbPrefix.'_id'],$dbPrefix)){
$r[$length]['children'] = $t;
}
}
}
return $r;
}
}
if ( !function_exists('_findChildren2') ) {
function _findChildren2($list,$p_id){
$r = array();
foreach($list as $id=>$item){
if($item['color_id'] == $p_id) {
$length = count($r);
$r[$length] = $item;
if($t = _findChildren2($list, $item['color_id'])){
$r[$length]['children'] = $t;
}
}
}
return $r;
}
}
if ( !function_exists('getCateOption') ) {
function getCateOption($c,$level,$maximumLevel=0,$dbPrefix="cate") {
global $cateOption;
$space = '';
// $level = level of category
if($maximumLevel<2) { $maximumLevel = 0; }
if( isset($c['name']) && $c['name']) {
//for($j=1;$j<=$level;$j++) { $space .= $j>1 ? ' ' : ($level==1 ? '└' : ''); }
//if($level>1) { $space .= '└'; }
for($j=1;$j<=$level;$j++) { $space .= $j>1 ? ' ' : ($level==1 ? '' : ''); }
if($j>1) { $space .= '└ '; }
$cateOption .= '';
}
if(isset($c['children']) && is_array($c['children'])) {
$level++;
if($level<$maximumLevel-1 || $maximumLevel==0) {
foreach($c['children'] as $cn) {
getCateOption($cn,$level,$maximumLevel,$dbPrefix);
}
}
}
}
}
if ( !function_exists('getCateArray') ) {
function getCateArray($c,$level,$maximumLevel=0,$dbPrefix="cate") {
global $cateOption;
$space = '';
// $level = level of category
if($maximumLevel<2) { $maximumLevel = 0; }
if($c['name']) {
//for($j=1;$j<=$level;$j++) { $space .= $j>1 ? ' ' : ($level==1 ? '└' : ''); }
//if($level>1) { $space .= '└'; }
for($j=1;$j<=$level;$j++) { $space .= $j>1 ? ' ' : ($level==1 ? '' : ''); }
if($j>1) { $space .= '└ '; }
$c['value'] = $c[$dbPrefix.'_id'];
$c['label'] = $space.' '.$c['name'];
$c['level'] = $level;
if( isset($c['children']) && is_array($c['children'])) { $hasChild = true; $child = $c['children']; $c['haschildren'] = 1; }
unset($c['children']);
$cateOption[] = $c;
}
if( isset($hasChild) && $hasChild) {
$level++;
if($level<$maximumLevel-1 || $maximumLevel==0) {
foreach($child as $cn) {
getCateArray($cn,$level,$maximumLevel,$dbPrefix);
}
}
}
}
}
if ( !function_exists('getCateArray2') ) {
function getCateArray2($c,$level,$maximumLevel=0) {
global $cateOption;
// $level = level of category
if($maximumLevel<2) { $maximumLevel = 0; }
if($c['name']) {
//for($j=1;$j<=$level;$j++) { $space .= $j>1 ? ' ' : ($level==1 ? '└' : ''); }
//if($level>1) { $space .= '└'; }
for($j=1;$j<=$level;$j++) { $space .= $j>1 ? ' ' : ($level==1 ? '' : ''); }
if($j>1) { $space .= '└ '; }
$c['value'] = $c['color_id'];
$c['label'] = $space.' '.$c['name'];
$c['level'] = $level;
if(is_array($c['children'])) { $hasChild = true; $child = $c['children']; $c['haschildren'] = 1; }
unset($c['children']);
$cateOption[] = $c;
}
if($hasChild) {
$level++;
if($level<$maximumLevel-1 || $maximumLevel==0) {
foreach($child as $cn) {
getCateArray2($cn,$level,$maximumLevel);
}
}
}
}
}
/* ********** ********** ********** Get Select Option - Kenny @ 2015-08 ********** ********** ********** ********** ********** */
/* ********** ********** ********** Modified By - Kenny @ 2015-11 ********** ********** ********** ********** ********** */
if ( !function_exists('getOptionArray') ) {
function getOptionArray($type, $tb, $dbPrefix, $orderBy, $labelField, $valueField, $where="", $limit="", $firstlabel="Please select"){
global $db;
$Opt = array();
if ($type=="select"){
$Opt[] = array('label'=>$firstlabel);
}
$sql = "SELECT * FROM ".$tb;
if ($where!="" && $where!=NULL){
$sql.= " WHERE ".$where;
}
$sql.= " order by ".$dbPrefix."_".$orderBy;
if ($limit!="" && $limit!=NULL){
$sql.= " LIMIT ".$limit;
}
// print_r($sql);
$db->query($sql);
while($row = $db->fetchArray()) {
$tp['name'] = $row[$dbPrefix."_".$labelField];
$tp['label'] = $row[$dbPrefix."_".$labelField];
$tp['value'] = $row[$dbPrefix."_".$valueField];
$Opt[] = $tp;
}
return $Opt;
}
}
if ( !function_exists('getOptionList') ) {
function getOptionList($optArr, $value=null){
$optList = "";
foreach ($optArr as $key => $opt) {
$optList .= '
';
}
return $optList;
}
}
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('getVarByPost') ) {
function getVarByPost() {
if(count($_POST)) {
foreach($_POST as $key => $value) {
global ${$key};
if (is_array($value)) {
$temp_array = array();
foreach($value as $key2 => $value2) {
if(function_exists('mysql_real_escape_string')) {
$temp_array[$key2] = fBoxSQL(trim($value2));
} else {
$temp_array[$key2] = str_replace('"','\"',str_replace("'","\'",(trim($value2))));
}
}
${$key} = $_POST[$key] = $temp_array;
} else {
if(function_exists('mysql_real_escape_string')) {
${$key} = fBoxSQL(trim($value));
} else {
${$key} = $_POST[$key] = str_replace('"','\"',str_replace("'","\'",(trim($value))));
}
}
}
}
}
}
if ( !function_exists('getVarByGet') ) {
function getVarByGet() {
if(count($_GET)) {
foreach($_GET as $key => $value) {
global ${$key};
if (is_array($value)) {
$temp_array = array();
foreach($value as $key2 => $value2) {
if(function_exists('mysql_real_escape_string')) {
//$temp_array[$key2] = mysql_real_escape_string(trim($value2));
$temp_array[$key2] = fBoxSQL(trim($value2));
} else {
$temp_array[$key2] = str_replace('"','\"',str_replace("'","\'",(trim($value2))));
}
}
${$key} = $_GET[$key] = $temp_array;
} else {
if(function_exists('mysql_real_escape_string')) {
//${$key} = mysql_real_escape_string(trim($value));
${$key} = fBoxSQL(trim($value));
} else {
${$key} = $_GET[$key] = str_replace('"','\"',str_replace("'","\'",(trim($value))));
}
}
}
}
} /* getVarByGet */
}
if ( !function_exists('fBoxSQL') ) {
function fBoxSQL( $iText ) {
$oText = $iText;
/* Chop */
$oText = str_replace( '\\\\' , '\\' , $oText );
$oText = str_replace( '\"' , '"' , $oText );
$oText = str_replace( "\'" , "'" , $oText );
$oText = str_replace( "'" , "''" , $oText );
return $oText;
} /* fBoxSQL */
}
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('tc2sc') ) {
function tc2sc($text) { return fConvertChinese($text,1); }
}
if ( !function_exists('sc2tc') ) {
function sc2tc($text) { return fConvertChinese($text); }
}
if ( !function_exists('fConvertChinese') )
{ function fConvertChinese( $iText , $iS2T = 0 ) {
$vText = $iText;
/* */
$ccUTF8TC = '夢緣丟並採亂亙亞嚲來侖侶俁俠倀倆倉個們倫偉側偵偽傑傖傘備傭傳傴債傷傾僂僅僉僑僕僥僨僱價儀儂億當儈儉儐儔儕盡償優儲儷羅攢儺儻儼兇兌兒兗內兩冊塗凍凜瀆處凱憑別刪剗剄則剛剝剮剴創鏟劃劇劉劊劌劍劑勁動務勩勛勝勞勢績勱勵勸勻匭匯匱奩櫝區協卻厙廳廁厭廠厲厴參靉靆叢吳呂咼員唄唚嗊啢問啓啞銜囉嘽喚喪喬單喲嗆嗇嗎嗚嗩嗶嘆嘍嘔嘖嘗嘜嘩嘮嘯嘰嘵嘸噅噓噝噠噥噦噯噲噴噸嚀嚇嚌嚕嚙嚦嚨嚮嚳嚴嚶囀囁囅囈蘇囑國圇圍園圓圖團坰墶壋垵壩埡執堅堊堖堝階堯報場壪塊塋塏塒塢塤塵塹磚墊墜磽墮壇墳牆墾壓壘壙壚壞壟壢壯壼壺壽夠夾奐奧奪奮妝姍姦姪娛嫵婁婦婭嫿媧媯媼媽裊嫗嫻嬈嬋嬌嬙嬡嬤嬪嬰嬸懶孌孫學孿宮寢實寧審寫寬寵寶將專尋對導尷屓屆屍屜屢層屨屬岡嶨嶢峴島峽嶮崍崗崬崢崳嵐歲嶔嶁嶄嶇嶗嶠嶧嶴嶸嶺嶼巋巒巔巰巹帥師帳帶幀幃幗幘幟幣幫幬襴幹幾庫廎廂廈蔭廚廝廟廡廢廣廩廬弳張強彈彌彎彠彥彫徑從徠複徵徹恆悅悵悶悽惱惲惻愛愜愨愴愷愾態慍慘慚慟慣慪慫憖慮慳懾慶憂憊憐憒憚憤憫憮憲憶懇應懌懍懨懟懣懲懷懸懺懼歡戀戇戔戧戩戲戰戶拋掗撏挾捫掃掄掙掛揀揚換揮構撳損搖搗搶摑摜摟摯摳摶摻撈撐撓撟撣撥撫撲撻撾撿擁擄擇擊擋擔攜據擠舉擬擯擰擱擲擴擷擺擻擼擾攄攆攏攔攖攙攛攝攣攤攪攬敘敗敵數驅斂斃斕斬斷暘曨時晉晝暈暉暢暫暱曄曇曉曖曠曡曬書會朧東柵桿梔梘條梟檮棶棄棖棗棟棧棬棲椏楊楓楨業極榪榮榿盤槍槓檟槧槨槳規樁樂樅樓標樞樣樸樹樺橈橋機橢橫橰檁檉檔檜檢檣檳檸檻檾櫃櫓櫚櫛櫞櫟櫥櫧櫨櫪櫫櫬櫳櫸欞櫻欄權欏欒欖欽歐歟歸歿殘殞殤殫殮殯殲殺殼毀毆醫絨毿犛氈氌氣氫氬氳氹決沍沒沖渢濔況洩洶溮滻濜浹涇溳涼淚淥淨淩淪淵淶淺渙減渦測渾湊湞湣湧湯漊溈準溝溫濕滄滅滌滎澦滬滯滲鹵滸滾滿漁漚漢漣漬漲漵漸漿潁潑潔潛潤潯潰潷潿澀澆澇澗澠澤澩澮澱濁濃濘濟濤濫濰濱闊濺濼濾瀅瀉瀋瀏瀕瀘瀝瀟瀠瀦瀧瀨瀲瀾灃灄灑灕灘灝灣灤灧災為烏烴無煆輝煉煒煙煢煥煩煬熒熗熱熲熾燁燄燈燉燒燙燜營燦燭燴燻燼燾燿爍爐爛爭爺爾牀箋閘牘牽犖犢犧狀獮狹狽猙猶猻獁獃獄獅獎獨獪獫獰獲獵獷獸獺獻獼玀茲璵瑒玨瑲璫現璡琿瑉瑋瑣瑤瑩瑪璉璣璦環璽瓊瓏瓔瓚甌罌產畝畢畫異疇痙瘂瘮瘋瘍瘓瘞瘡瘧瘻療癆癇癉癘癟癡癢癤癥癧癩癬癭癮癰癱癲發皚皸皺藹礙襖罷頒辦絆綁鎊謗盜盞監盧蕩視矓眾睜飽鮑輩貝鋇繃筆閉邊編貶變辯辮鱉賓餅睞瞘瞞瞼矚缽鉑駁補財蠶蒼艙詫蟬饞讒纏闡顫矯硜磑礄硤硨硯磣長腸鈔車陳襯稱誠騁遲馳齒蟲躊籌綢醜鋤雛碩碭碸確碼磧磯礎觸闖錘純綽辭詞賜聰蔥躥竄錯達貸礦礪礫礬礱禕祿禍禎鄲膽誕黨禱鄧遞締顛點電釣調諜禦禪禮禰禿穠稅稈稜釘頂錠訂鬥讀賭鍍鍛緞隊頓鈍鵝額訛餓餌稟種穀穌積穎穡穢頹穩穭貳罰閥釩範販飯訪紡飛誹費紛糞豐鋒風馮縫諷鳳膚輻窩窪窮窯窶窺竅竇竊豎競輔賦負訃縛該鈣蓋趕贛鋼綱鎬鴿閣鉻給筍簹筧箏籙節龔鞏貢鉤購蠱顧關觀館貫龜閨軌詭貴輥鍋過築篋篠篤篩篳簀簍簑簞簡簣簫簷簽簾駭韓號閡鶴賀轟鴻紅後籃籐籜籟籠鑰籩籪籬籮籲粵護華話還緩黃謊賄諱誨繪葷夥貨糝糢糧糲糴糶糾紀紂約紆紇紈紉紋納紐紓紕紖紗紘紙級紜紝細紱紲紳紵饑跡譏雞緝輯薊計記際繼莢頰賈鉀駕間艱緘繭薦鑒踐賤見鍵紹紺紼紿絀終組絎結絕縧絝絞絡絢絰統絲絳絹綃綆綈繡綌綏經艦餞蔣講醬膠驕鉸腳餃繳轎較誡緊錦謹進綜綞綠綣綬維綯綰網綴綸綹綺綻綾綿緄緇緋緡緒緓緔緗緙緦緬緯緱緲練緶緹荊莖鯨驚頸靜鏡舊駒鋸鵑覺訣鈞軍縕總縈縉縊縋縐縑縗縝縞縟縣縭縮縱縲纖縵縶縷縹繅繆繈繒織繕繚駿開顆課褲誇虧繞繢繩韁繯繰繹繽繾纇纈纊續纓纘纜饋蠟臘萊賴藍闌蘭讕覽鐳類離鯉麗罵羆羈羋羥羨義習翽翬隸聯蓮連鐮臉鏈輛諒遼鐐臨鄰鱗賃齡鈴靈領餾龍聾翹翺耬耮聖聞聲聳聵聶職聹聽隴蘆顱虜魯賂錄陸驢鋁輪論蘿邏鑼騾駱螞馬買麥賣邁脈饅蠻肅脅脛脫脹謾貓錨鉚貿麼鎂門錳謎覓閩鳴銘謬腎腖膕腡腦腫膁膃膩膾膿臍臏臒謀鈉難鬧餒釀鳥鑷鎳臚臢髒臠臥臯與興鋪艤鈕農諾鷗龐賠鵬艫艷艸芻苧騙飄頻貧蘋評頗譜齊騎豈訖薘莊莧釺鉛遷謙錢鉗譴薔鍬親輕頃請趨軀萇蘀萬萵葉葒葤葦藥齲顴鵲讓饒韌認軟銳閏薩鰓賽蒓蒔蓀蓧蓯蓽騷閃陝贍賞賒設蔞蔦蕁蕆蕎蕒蕓蕕蕘蕢蕪蕭蕷詩蝕識駛適釋飾試輸贖術薈薌薑薟薺藎藝藪藶雙誰順說飼頌訟誦訴雖隨鎖藺蘄蘊蘚蘞蘢蘺虛貪譚談討騰謄銻題體貼鐵蛺蛻蜆銅頭鴕馱駝襪頑蝟蝦蝨蝸螿螄蟻螢韋違謂衛鎢誣霧誤錫螻蟄蟈蟎蠨蟣蟯蟶蠅蠆蠍蠐蠑蠣襲銑轄鍁鮮鹹賢閑顯險餡鑲鄉詳響項銷衊褘袞諧謝鋅釁鏽須許軒襏褌裝褳選詢馴訓訊遜鴉鴨訝閹鹽顏閻諺驗鴦陽養褸褻襆襇雜襝襠襤覎覘覡遙謠頁銥頤遺詣議誼譯陰銀飲隱覥覦覬覯覷覲覿觴觶訁訌訐訒訕鷹贏踴詠郵鈾誘輿魚語譽訥諶訩訶診註證詁詆詎詐詒詔詖詗詘詛讋詡詬詮詰詵詼詿預馭鴛轅遠願躍閱雲鄖隕運醞韻載贊贓鑿責賊贈軋誄誅誆誑誒誚誥誶諂諄諉諍諏諑諗諛諝諞諡諢鍘齋輾賬趙轍鍺這貞針鎮陣諤諦諫諭諳諸諼謁謅謐謔謖謨謫謳鄭質鐘軸驟豬著貯鑄譎譖譙譫譸譾讎讖讜讞駐轉賺錐贅資蹤鄒鑽豶貍貟鞀靨贗賾貰貲貺貽賁賅賑賕賙賚賡賧賫贐賵賻贄贇黌鳧贔赬趲陘隉鄺鄔鄴躂踡蹌蹕蹠蹣郟鄶郤鄆酈蹺躉躋躑躒躓躕躚躡躦躪軑軔軛軤軫軲軹軺軻軼軾輅輇輈輊輒輜輞輟輦輬輳轀轂鶯驀鎣轆轔轡轢轤邇邐醱釃釅釓釔釕釗釙釤麅釧釵釷釹鈀鈁鈃鈄鈈鈐鈑鈒鈥鈦鈧鈮鈰鈳鈷鈸鈹鈺鈽鈿餳飩餼飪飫飭飴餉餑餘餛餷餿饃饈饉饊饌饢鉈鉉鉍鉕鉞鉦鉬鉭鐦鉶鉺鉿銃銍銓銖銚銛銠銣銦閂閆闈閎閔閌闥閭閫鬮閬閾閶鬩閿閽閼闃闋闔闐闕闞爿銨銩銪銫銬銱銼鎇鋃鋌鋏鋙鐲鋝鋟鋣鋥鋦鋨鋩鋮鋯鋰鋱鋶錁錆錇錈錏錒錕錙錚錛錟錡錩錮錸鎿鍀鍃鍆鍇鍈鍔鍚鍠鍤鍥鍩騫鍰鍶鎄鎔鎘鎛鎡鎦鎧鎩鎪鎰鎲鎵鐫鏃鏇鏌鏍駔駟駙騶驛駑駘驍驊駢驪騏騍騅驂騭騖驁騮騸驃驄驏驥驤糸鏐鏑鏗鏘鏜鏝鏞鏢鏤鏨鏰鏵鏷鏹鐃鐋鐒鐓鐔鐙钁鐠鐧鐨頊鐶鐸鐺鐿鑊鑌鑔鑕鑞鑠鑣鑥鑭鑱鑹鑾韙韞韜閈闍闒闓闠闤靦霽靂靄靚颮颯颶颼飆齏於鞽韃韉韍韝頇頎龕頏頜頡頦頮頲頴頷顎顒顓顙顢顥顬顰顳颭颸颻飀飣飥飿餄餎餏餕餖餚餜餶餺饁饗饜鳩鳶鴇鴆鴣鶇鸕鴝鴟鷥鴯鷙鴰鵂鸞鵓鸝鵠鵒鷳鵜鵡鶓鵪鵯鶉鶘鶚鶿鶥鶩鷂鶼鸚鷓鷚鷯鷦鷲鷸鸌鷺鸛馹駰駸騂騌騤驌驦驫鯁髏髕髖鬢鬱魎魘魛魢魨魴魷魺麩鮁鮃鮊鮋鯀鮍鮎鮐鮒鮓鮚鮜鮞鮦鮪鮫鮭鮳鮶鯷鮺鯇鯊鯒鯔鯕鯖鯗鯛醯鹺鯝鯡鯢鯤鯧鯪鯫鯰鯴鰺鯽鯿鰁鰂鰃鰈鰉鰍鰏鱷鰒鰮鰜鰟鰠鰣鰥鰨鰩鰭鰱鰲鰳鰵鰷鰹鰻齔齟齙齠齜齦齬齪齷黽黿鼉鱸鱟鱭鱘鱺鱝鰼鰾鱂鱅鱈鱒鱔鱖鱠鱣鱤鱧鱨鱯鶻黷黲鼴齇鳲鴒鴞鴬鴴鵃鵐鵮鵷鵾鶊鶖鶡鶬鶲鶹鶺鷁鷊鷖鷫鸇鸏鸘黶鼂齕齗飈邨鉅俔倈剎龎叄吶壠奼弒悞戱挩搵槤梲榲熅瘲瞶禡窵篔骯虆薀誾逕酇釒鍾霢颺飠餘礆恥囪惡琺廄扡甕囂紮佇諮槁醃齶遝蠔秈餱雋線蒞託訢鉋眥磣';
$ccUTF8SC = '梦缘丢并采乱亘亚亸来仑侣俣侠伥俩仓个们伦伟侧侦伪杰伧伞备佣传伛债伤倾偻仅佥侨仆侥偾雇价仪侬亿当侩俭傧俦侪尽偿优储俪罗攒傩傥俨凶兑儿兖内两册涂冻凛渎处凯凭别删刬刭则刚剥剐剀创铲划剧刘刽刿剑剂劲动务勚勋胜劳势绩劢励劝匀匦汇匮奁椟区协却厍厅厕厌厂厉厣参叆叇丛吴吕呙员呗吣唝唡问启哑衔啰啴唤丧乔单哟呛啬吗呜唢哔叹喽呕啧尝唛哗唠啸叽哓呒咴嘘咝哒哝哕嗳哙喷吨咛吓哜噜啮呖咙响喾严嘤啭嗫冁呓苏嘱国囵围园圆图团垧垯垱埯坝垭执坚垩垴埚阶尧报场塆块茔垲埘坞埙尘堑砖垫坠硗堕坛坟墙垦压垒圹垆坏垄坜壮壸壶寿够夹奂奥夺奋妆姗奸侄娱妩娄妇娅婳娲妫媪妈袅妪娴娆婵娇嫱嫒嬷嫔婴婶懒娈孙学孪宫寝实宁审写宽宠宝将专寻对导尴屃届尸屉屡层屦属冈峃峣岘岛峡崄崃岗岽峥嵛岚岁嵚嵝崭岖崂峤峄岙嵘岭屿岿峦巅巯卺帅师帐带帧帏帼帻帜币帮帱襕干几库庼厢厦荫厨厮庙庑废广廪庐弪张强弹弥弯彟彦雕径从徕复征彻恒悦怅闷凄恼恽恻爱惬悫怆恺忾态愠惨惭恸惯怄怂慭虑悭慑庆忧惫怜愦惮愤悯怃宪忆恳应怿懔恹怼懑惩怀悬忏惧欢恋戆戋戗戬戏战户抛挜挦挟扪扫抡挣挂拣扬换挥构揿损摇捣抢掴掼搂挚抠抟掺捞撑挠挢掸拨抚扑挞挝捡拥掳择击挡担携据挤举拟摈拧搁掷扩撷摆擞撸扰摅撵拢拦撄搀撺摄挛摊搅揽叙败敌数驱敛毙斓斩断旸昽时晋昼晕晖畅暂昵晔昙晓暧旷叠晒书会胧东栅杆栀枧条枭梼梾弃枨枣栋栈桊栖桠杨枫桢业极杩荣桤盘枪杠槚椠椁桨规桩乐枞楼标枢样朴树桦桡桥机椭横槔檩柽档桧检樯槟柠槛苘柜橹榈栉橼栎橱槠栌枥橥榇栊榉棂樱栏权椤栾榄钦欧欤归殁残殒殇殚殓殡歼杀壳毁殴医绒毵牦毡氇气氢氩氲凼决冱没冲沨沵况泄汹浉浐浕浃泾涢凉泪渌净凌沦渊涞浅涣减涡测浑凑浈愍涌汤溇沩准沟温湿沧灭涤荥滪沪滞渗卤浒滚满渔沤汉涟渍涨溆渐浆颍泼洁潜润浔溃滗涠涩浇涝涧渑泽泶浍淀浊浓泞济涛滥潍滨阔溅泺滤滢泻渖浏濒泸沥潇潆潴泷濑潋澜沣滠洒漓滩灏湾滦滟灾为乌烃无煅辉炼炜烟茕焕烦炀荧炝热颎炽烨焰灯炖烧烫焖营灿烛烩熏烬焘耀烁炉烂争爷尔床笺闸牍牵荦犊牺状狝狭狈狰犹狲犸呆狱狮奖独狯猃狞获猎犷兽獭献猕猡兹玙玚珏玱珰现琎珲珉玮琐瑶莹玛琏玑瑷环玺琼珑璎瓒瓯罂产亩毕画异畴痉痖瘆疯疡痪瘗疮疟瘘疗痨痫瘅疠瘪痴痒疖症疬癞癣瘿瘾痈瘫癫发皑皲皱蔼碍袄罢颁办绊绑镑谤盗盏监卢荡视眬众睁饱鲍辈贝钡绷笔闭边编贬变辩辫鳖宾饼睐眍瞒睑瞩钵铂驳补财蚕苍舱诧蝉馋谗缠阐颤矫硁硙硚硖砗砚碜长肠钞车陈衬称诚骋迟驰齿虫踌筹绸丑锄雏硕砀砜确码碛矶础触闯锤纯绰辞词赐聪葱蹿窜错达贷矿砺砾矾砻祎禄祸祯郸胆诞党祷邓递缔颠点电钓调谍御禅礼祢秃秾税秆棱钉顶锭订斗读赌镀锻缎队顿钝鹅额讹饿饵禀种谷稣积颖穑秽颓稳稆贰罚阀钒范贩饭访纺飞诽费纷粪丰锋风冯缝讽凤肤辐窝洼穷窑窭窥窍窦窃竖竞辅赋负讣缚该钙盖赶赣钢纲镐鸽阁铬给笋筜笕筝箓节龚巩贡钩购蛊顾关观馆贯龟闺轨诡贵辊锅过筑箧筱笃筛筚箦篓蓑箪简篑箫檐签帘骇韩号阂鹤贺轰鸿红后篮藤箨籁笼钥笾簖篱箩吁粤护华话还缓黄谎贿讳诲绘荤伙货糁模粮粝籴粜纠纪纣约纡纥纨纫纹纳纽纾纰纼纱纮纸级纭纴细绂绁绅纻饥迹讥鸡缉辑蓟计记际继荚颊贾钾驾间艰缄茧荐鉴践贱见键绍绀绋绐绌终组绗结绝绦绔绞络绚绖统丝绛绢绡绠绨绣绤绥经舰饯蒋讲酱胶骄铰脚饺缴轿较诫紧锦谨进综缍绿绻绶维绹绾网缀纶绺绮绽绫绵绲缁绯缗绪绬绱缃缂缌缅纬缑缈练缏缇荆茎鲸惊颈静镜旧驹锯鹃觉诀钧军缊总萦缙缢缒绉缣缞缜缟缛县缡缩纵缧纤缦絷缕缥缫缪襁缯织缮缭骏开颗课裤夸亏绕缋绳缰缳缲绎缤缱颣缬纩续缨缵缆馈蜡腊莱赖蓝阑兰谰览镭类离鲤丽骂罴羁芈羟羡义习翙翚隶联莲连镰脸链辆谅辽镣临邻鳞赁龄铃灵领馏龙聋翘翱耧耢圣闻声耸聩聂职聍听陇芦颅虏鲁赂录陆驴铝轮论萝逻锣骡骆蚂马买麦卖迈脉馒蛮肃胁胫脱胀谩猫锚铆贸么镁门锰谜觅闽鸣铭谬肾胨腘脶脑肿肷腽腻脍脓脐膑癯谋钠难闹馁酿鸟镊镍胪臜脏脔卧皋与兴铺舣钮农诺鸥庞赔鹏舻艳艹刍苎骗飘频贫苹评颇谱齐骑岂讫荙庄苋钎铅迁谦钱钳谴蔷锹亲轻顷请趋躯苌萚万莴叶荭荮苇药龋颧鹊让饶韧认软锐闰萨鳃赛莼莳荪莜苁荜骚闪陕赡赏赊设蒌茑荨蒇荞荬芸莸荛蒉芜萧蓣诗蚀识驶适释饰试输赎术荟芗姜莶荠荩艺薮苈双谁顺说饲颂讼诵诉虽随锁蔺蕲蕴藓蔹茏蓠虚贪谭谈讨腾誊锑题体贴铁蛱蜕蚬铜头鸵驮驼袜顽猬虾虱蜗螀蛳蚁萤韦违谓卫钨诬雾误锡蝼蛰蝈螨蟏虮蛲蛏蝇虿蝎蛴蝾蛎袭铣辖锨鲜咸贤闲显险馅镶乡详响项销蔑袆衮谐谢锌衅锈须许轩袯裈装裢选询驯训讯逊鸦鸭讶阉盐颜阎谚验鸯阳养褛亵幞裥杂裣裆褴觃觇觋遥谣页铱颐遗诣议谊译阴银饮隐觍觎觊觏觑觐觌觞觯讠讧讦讱讪鹰赢踊咏邮铀诱舆鱼语誉讷谌讻诃诊注证诂诋讵诈诒诏诐诇诎诅詟诩诟诠诘诜诙诖预驭鸳辕远愿跃阅云郧陨运酝韵载赞赃凿责贼赠轧诔诛诓诳诶诮诰谇谄谆诿诤诹诼谂谀谞谝谥诨铡斋辗账赵辙锗这贞针镇阵谔谛谏谕谙诸谖谒诌谧谑谡谟谪讴郑质钟轴骤猪着贮铸谲谮谯谵诪谫雠谶谠谳驻转赚锥赘资踪邹钻豮狸贠鼗靥赝赜贳赀贶贻贲赅赈赇赒赉赓赕赍赆赗赙贽赟黉凫赑赪趱陉陧邝邬邺跶蜷跄跸跖蹒郏郐郄郓郦跷趸跻踯跞踬蹰跹蹑躜躏轪轫轭轷轸轱轵轺轲轶轼辂辁辀轾辄辎辋辍辇辌辏辒毂莺蓦蓥辘辚辔轹轳迩逦酦酾酽钆钇钌钊钋钐狍钏钗钍钕钯钫钘钭钚钤钣钑钬钛钪铌铈钶钴钹铍钰钸钿饧饨饩饪饫饬饴饷饽余馄馇馊馍馐馑馓馔馕铊铉铋钷钺钲钼钽锎铏铒铪铳铚铨铢铫铦铑铷铟闩闫闱闳闵闶闼闾阃阄阆阈阊阋阌阍阏阒阕阖阗阙阚丬铵铥铕铯铐铞锉镅锒铤铗铻镯锊锓铘锃锔锇铓铖锆锂铽锍锞锖锫锩铔锕锟锱铮锛锬锜锠锢铼镎锝锪钔锴锳锷钖锽锸锲锘骞锾锶锿镕镉镈镃镏铠铩锼镒镋镓镌镞镟镆镙驵驷驸驺驿驽骀骁骅骈骊骐骒骓骖骘骛骜骝骟骠骢骣骥骧纟镠镝铿锵镗镘镛镖镂錾镚铧镤镪铙铴铹镦镡镫镢镨锏镄顼镮铎铛镱镬镔镲锧镴铄镳镥镧镵镩銮韪韫韬闬阇阘闿阓阛腼霁雳霭靓飑飒飓飕飙齑于鞒鞑鞯韨鞴顸颀龛颃颌颉颏颒颋颕颔颚颙颛颡颟颢颥颦颞飐飔飖飗饤饦饳饸饹饻馂饾肴馃馉馎馌飨餍鸠鸢鸨鸩鸪鸫鸬鸲鸱鸶鸸鸷鸹鸺鸾鹁鹂鹄鹆鹇鹈鹉鹋鹌鹎鹑鹕鹗鹚鹛鹜鹞鹣鹦鹧鹨鹩鹪鹫鹬鹱鹭鹳驲骃骎骍骔骙骕骦骉鲠髅髌髋鬓郁魉魇鱽鱾鲀鲂鱿鲄麸鲅鲆鲌鲉鲧鲏鲇鲐鲋鲊鲒鲘鲕鲖鲔鲛鲑鲓鲪鳀鲝鲩鲨鲬鲻鲯鲭鲞鲷酰鹾鲴鲱鲵鲲鲳鲮鲰鲶鲺鲹鲫鳊鳈鲗鳂鲽鳇鳅鲾鳄鳆鳁鳒鳑鳋鲥鳏鳎鳐鳍鲢鳌鳓鳘鲦鲣鳗龀龃龅龆龇龈龉龊龌黾鼋鼍鲈鲎鲚鲟鲡鲼鳛鳔鳉鳙鳕鳟鳝鳜鲙鳣鳡鳢鲿鳠鹘黩黪鼹齄鸤鸰鸮鸴鸻鸼鹀鹐鹓鹍鹒鹙鹖鸧鹟鹠鹡鹢鹝鹥鹔鹯鹲鹴黡鼌龁龂飚村钜伣俫刹厐叁呐垅姹弑悮戯捝揾梿棁榅煴疭瞆祃窎筼肮蔂蕰訚迳酂钅锺霡飏饣余硷耻囱恶珐厩扦瓮嚣扎伫谘藁腌腭沓蚝籼糇隽线莅讬铇眦碜碱';
/* For Extent List Use */
$ccUTF8TC.= "";
$ccUTF8SC.= "";
/* */
for ( $i = 0 ; $i < strlen($ccUTF8TC) ; $i++ )
{
$strTC = substr( $ccUTF8TC , $i , 3 );
$strSC = substr( $ccUTF8SC , $i , 3 );
$i+= 2;
if ( $iS2T == 1 )
{
$vText = str_replace( $strTC , $strSC , $vText );
}
else
{
$vText = str_replace( $strSC , $strTC , $vText );
}
}
return($vText);
} }
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
if ( !function_exists('fGetLangCnt') ) {
function fGetLangCnt( $iFldName , $iAry ) {
global $lang;
$oText = $iAry[$iFldName];
switch($lang)
{ /* ********** ********** ********** ********** ********** */
case 'tc':
if ( $oText == '' && isset($iAry[$iFldName.'_sc']) ) { $oText = sc2tc($iAry[$iFldName.'_sc']); }
if ( $oText == '' && isset($iAry[$iFldName.'_en']) ) { $oText = $iAry[$iFldName.'_en']; }
break;
/* ********** ********** ********** ********** ********** */
case 'sc':
if ( $oText == '' && isset($iAry[$iFldName.'_tc']) ) { $oText = tc2sc($iAry[$iFldName.'_tc']); }
if ( $oText == '' && isset($iAry[$iFldName.'_en']) ) { $oText = $iAry[$iFldName.'_en']; }
break;
/* ********** ********** ********** ********** ********** */
case 'en':
if ( $oText == '' && isset($iAry[$iFldName.'_tc']) ) { $oText = $iAry[$iFldName.'_tc']; }
if ( $oText == '' && isset($iAry[$iFldName.'_sc']) ) { $oText = $iAry[$iFldName.'_sc']; }
break;
/* ********** ********** ********** ********** ********** */
}
return trim( $oText );
} } /* fGetLangCnt */
/* ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** */
function noChild($p_id,$tb,$dbPrefix="cate"){
global $clsMySQL;
$sql = "SELECT * FROM {$tb} WHERE {$dbPrefix}_pid='{$p_id}'";
$clsMySQL->execQuery($sql);
if ($clsMySQL->recordCount()>0){
return false;
}
return true;
}
?>