コード例 #1
0
ファイル: Charts.php プロジェクト: honj51/taobaocrm
function save_xml_file($filename, $xml_file)
{
    global $app_strings;
    $handle = fopen($filename, 'w');
    //fwrite($handle,iconv("GBK","UTF-8",$xml_file));
    if (!$handle) {
        return;
    }
    // Write $somecontent to our opened file.)
    if ($app_strings['LBL_CHARSET'] == "GBK") {
        if (function_exists('iconv')) {
            $xml_file = iconv_ec("GB2312", "UTF-8", $xml_file);
        } else {
            $chs = new Chinese("GBK", "UTF8", trim($xml_file));
            $xml_file = $chs->ConvertIT();
        }
        if (fwrite($handle, $xml_file) === FALSE) {
            return false;
        }
    } else {
        if ($app_strings['LBL_CHARSET'] != "UTF-8") {
            //$xml_file = iconv("ISO-8859-1","UTF-8",$xml_file);
            if (fwrite($handle, utf8_encode($xml_file)) === FALSE) {
                return false;
            }
        } else {
            if (fwrite($handle, $xml_file) === FALSE) {
                return false;
            }
        }
    }
    fclose($handle);
    return true;
}
コード例 #2
0
ファイル: yeepay.php プロジェクト: GHubgenius/qbbj
 function iconv($s, $d, $string)
 {
     require_once ROOT_PATH . "inc/class.chinese.php";
     $cnvert = new Chinese("GB2312", "UTF8", $string, ROOT_PATH . "./inc/gbkcode/");
     $string = $cnvert->ConvertIT();
     return $string;
 }
コード例 #3
0
ファイル: pinyin.php プロジェクト: GHubgenius/qbbj
function change2pinyin($str, $type = '')
{
    $ret = "";
    if (WEB_LANG == 'utf-8') {
        if (function_exists('iconv')) {
            $str = iconv('UTF-8', 'GBK//IGNORE', $str);
        } else {
            require_once ROOT_PATH . "inc/class.chinese.php";
            $cnvert = new Chinese("UTF8", "GB2312", $str, ROOT_PATH . "./inc/gbkcode/");
            $str = $cnvert->ConvertIT();
        }
    } elseif (WEB_LANG == 'big5') {
        require_once ROOT_PATH . "inc/class.chinese.php";
        $cnvert = new Chinese("BIG5", "GB2312", $str, ROOT_PATH . "./inc/gbkcode/");
        $str = $cnvert->ConvertIT();
    }
    for ($i = 0; $i < strlen($str); $i++) {
        $p = ord(substr($str, $i, 1));
        if ($p > 160) {
            $q = ord(substr($str, ++$i, 1));
            $p = $p * 256 + $q - 65536;
        }
        $ret .= GetPinYin($p, $type);
    }
    return $ret;
}
コード例 #4
0
/**
 * Smarty trimwhitespace outputfilter plugin
 *
 * File:     outputfilter.trimwhitespace.php<br>
 * Type:     outputfilter<br>
 * Name:     trimwhitespace<br>
 * Date:     Jan 25, 2003<br>
 * Purpose:  trim leading white space and blank lines from
 *           template source after it gets interpreted, cleaning
 *           up code and saving bandwidth. Does not affect
 *           <<PRE>></PRE> and <SCRIPT></SCRIPT> blocks.<br>
 * Install:  Drop into the plugin directory, call
 *           <code>$smarty->load_filter('output','trimwhitespace');</code>
 *           from application.
 * @author   Monte Ohrt <monte at ohrt dot com>
 * @author Contributions from Lars Noschinski <*****@*****.**>
 * @version  1.3
 * @param string
 * @param Smarty
 */
function smarty_outputfilter_langset($source, &$smarty)
{
    if ($_SESSION['langset'] == 'zh_tw') {
        //$source = iconv('UTF-8', 'GB2312'.'//TRANSLIT', $source);
        $source = iconv('UTF-8', 'GB2312' . '//IGNORE', $source);
        $objCnvert = new Chinese("GB2312", "BIG5", $source, __WEBCOMMON_ROOT . '/chinese/config/');
        $source = $objCnvert->ConvertIT();
        $source = iconv('BIG5', 'UTF-8' . '//IGNORE', $source);
    }
    return $source;
}
コード例 #5
0
ファイル: pinyin-slug.php プロジェクト: hjm8809/xsphp.com
function pinyin_slugs($slug)
{
    // We don't want to change an existing slug
    if ($slug) {
        return $slug;
    }
    global $wpdb;
    require "class.Chinese.php";
    $codeTablesDir = dirname(__FILE__) . "/config/";
    // Replace post title
    $title = $_POST['post_title'];
    $chs = new Chinese("UTF8", "GB2312", $title, $codeTablesDir);
    $title = $chs->ConvertIT();
    $chs = new Chinese("GB2312", "PinYin", $title, $codeTablesDir);
    $title = $chs->ConvertIT();
    $title = str_replace(" ", "", $title);
    return sanitize_title($title);
}
コード例 #6
0
ファイル: upfile_eweb.php プロジェクト: GHubgenius/qbbj
require_once dirname(__FILE__) . "/" . "global.php";
//header('Content-Type: text/html; charset=utf-8');
if ($fileData) {
    if (!$lfjid) {
        //showerr("你还没登录",1);
    }
    //其中..与/开头都是不允许的
    if (!ereg("^[0-9a-z_/]+\$", $dir) || ereg("^/", $dir)) {
        $dir = "other";
    }
    $updir = '';
    $path = "{$updir}/{$dir}";
    $array[name] = is_array($fileData) ? $_FILES[fileData][name] : $fileData_name;
    require_once ROOT_PATH . "inc/class.chinese.php";
    $cnvert = new Chinese("UTF8", "GB2312", $array[name], ROOT_PATH . "./inc/gbkcode/");
    $array[name] = $cnvert->ConvertIT();
    $array[path] = $webdb[updir] . "/" . $path;
    $array[size] = is_array($fileData) ? $_FILES[fileData][size] : $fileData_size;
    //$array[updateTable]=1;	//统计用户上传的文件占用空间大小
    $lfjuid = $userdb[uid];
    //处理上传的文件名标志
    $filename = upfile(is_array($fileData) ? $_FILES[fileData][tmp_name] : $fileData, $array);
    $newfile = "{$webdb['www_url']}/{$webdb['updir']}/{$dir}/{$filename}";
    //插入数据,关闭层
    echo '<html>';
    echo '<head>';
    echo '<title>Insert Image</title>';
    echo '<meta http-equiv="content-type" content="text/html; charset=gb2312">';
    echo '</head>';
    echo '<body>';
    if (!$_GET[Ctype]) {
コード例 #7
0
ファイル: class.mail.php プロジェクト: GHubgenius/qbbj
 function sendmail($to, $from, $subject, $content, $T = 0)
 {
     global $webdb;
     //$name, $email, $subject, $content, $type=0
     $type = 1;
     //$name=array("{$webdb[webname]}会员");
     $email = array($to);
     $_CFG['smtp_host'] = $this->host;
     $_CFG['smtp_port'] = $this->port;
     $_CFG['smtp_user'] = $this->user;
     $_CFG['smtp_pass'] = $this->pass;
     $_CFG['name'] = $webdb[webname];
     $_CFG['smtp_mail'] = $from;
     if (WEB_LANG == 'big5') {
         require_once ROOT_PATH . "inc/class.chinese.php";
         $cnvert = new Chinese("BIG5", "GB2312", $subject, ROOT_PATH . "./inc/gbkcode/");
         $subject = $cnvert->ConvertIT();
         $cnvert = new Chinese("BIG5", "GB2312", $content, ROOT_PATH . "./inc/gbkcode/");
         $content = $cnvert->ConvertIT();
         //$cnvert = new Chinese("BIG5","GB2312",$name,ROOT_PATH."./inc/gbkcode/");
         //$name = $cnvert->ConvertIT();
         $cnvert = new Chinese("BIG5", "GB2312", $_CFG['name'], ROOT_PATH . "./inc/gbkcode/");
         $_CFG['name'] = $cnvert->ConvertIT();
     } elseif (WEB_LANG == 'utf-8') {
         require_once ROOT_PATH . "inc/class.chinese.php";
         $cnvert = new Chinese("UTF8", "GB2312", $subject, ROOT_PATH . "./inc/gbkcode/");
         $subject = $cnvert->ConvertIT();
         $cnvert = new Chinese("UTF8", "GB2312", $content, ROOT_PATH . "./inc/gbkcode/");
         $content = $cnvert->ConvertIT();
         //$cnvert = new Chinese("UTF8","GB2312",$name,ROOT_PATH."./inc/gbkcode/");
         //$name = $cnvert->ConvertIT();
         $cnvert = new Chinese("UTF8", "GB2312", $_CFG['name'], ROOT_PATH . "./inc/gbkcode/");
         $_CFG['name'] = $cnvert->ConvertIT();
     }
     //$name = "=?UTF-8?B?".base64_encode($name)."==?=";
     $subject = "=?gbk?B?" . base64_encode($subject) . "==?=";
     $content = base64_encode($content);
     $headers[] = "To:=?gbk?B?" . base64_encode($name[0]) . "?= <{$email['0']}>";
     $headers[] = "From:=?gbk?B?" . base64_encode($_CFG[name]) . "?= <{$_CFG['smtp_mail']}>";
     $headers[] = "MIME-Version: ";
     $headers[] = "X-Mailer: ";
     //$headers[] = "From:=?UTF-8?B?".base64_encode($_CFG['shop_name'])."==?=<$_CFG[smtp_mail]>";
     $headers[] = "Subject:{$subject}";
     $headers[] = $type == 0 ? "Content-Type: text/plain; charset=gbk; format=flowed" : "Content-Type: text/html; charset=gbk; format=flowed";
     $headers[] = "Content-Transfer-Encoding: base64";
     $headers[] = "Content-Disposition: inline";
     //    SMTP 服务器信息
     $params['host'] = $_CFG['smtp_host'];
     $params['port'] = $_CFG['smtp_port'];
     $params['user'] = $_CFG['smtp_user'];
     $params['pass'] = $_CFG['smtp_pass'];
     if (empty($params['host']) || empty($params['port'])) {
         // 如果没有设置主机和端口直接返回 false
         return false;
     } else {
         //  发送邮件
         $send_params['recipients'] = $email;
         $send_params['headers'] = $headers;
         $send_params['from'] = $_CFG['smtp_mail'];
         $send_params['body'] = $content;
         /*        
         echo "<pre>";
         print_r($params);
         print_r($send_params);
         echo "</pre>";
         exit;
         */
         $smtp = new qb_smtp($params);
         if ($smtp->connect() and $smtp->send($send_params)) {
             return TRUE;
         } else {
             return FALSE;
         }
         // end if
     }
 }
コード例 #8
0
ファイル: all_fun.php プロジェクト: holin/sstour
function uniDecode($str, $charcode)
{
    $text = preg_replace_callback("/%u[0-9A-Za-z]{4}/", toUtf8, $str);
    if (M_B == true) {
        return mb_convert_encoding($text, $charcode, 'utf-8');
    } else {
        if (ICONV == true) {
            return iconv("UTF-8", $charcode, $text);
        } else {
            include_once R_P . "chinese/class.Chinese.php";
            $codeTablesDir = R_P . "chinese/config/";
            $chs = new Chinese("UTF8", "GB2312", $text, $codeTablesDir);
            return $chs->ConvertIT();
        }
    }
}
コード例 #9
0
ファイル: comment_ajax.php プロジェクト: xubo245/liuyangzhang
        if ($rs[uid] != $lfjuid) {
            $username = "******";
        }
    }
    $rss = $db->get_one(" SELECT * FROM {$_pre}content{$_erp} WHERE id='{$id}' ");
    if (!$rss) {
        die("原数据不存在");
    }
    $fid = $rss[fid];
    $username || ($username = $lfjid);
    if (WEB_LANG == 'big5') {
        require_once ROOT_PATH . "inc/class.chinese.php";
        $cnvert = new Chinese("GB2312", "BIG5", $content, ROOT_PATH . "./inc/gbkcode/");
        $content = $cnvert->ConvertIT();
        $cnvert = new Chinese("GB2312", "BIG5", $username, ROOT_PATH . "./inc/gbkcode/");
        $username = $cnvert->ConvertIT();
    }
    $db->query("INSERT INTO `{$_pre}comments` (`cuid`, `type`, `id`, `fid`, `uid`, `username`, `posttime`, `content`, `ip`, `icon`, `yz`) VALUES ('{$rss['uid']}','0','{$id}','{$fid}','{$lfjuid}','{$username}','{$timestamp}','{$content}','{$onlineip}','{$icon}','{$yz}')");
    $db->query(" UPDATE {$_pre}content{$_erp} SET comments=comments+1 WHERE id='{$id}' ");
} elseif ($action == "del") {
    $_erp = $Fid_db[tableid][$fid];
    $rs = $db->get_one("SELECT * FROM `{$_pre}comments` WHERE cid='{$cid}'");
    if (!$lfjuid) {
        die("你还没登录,无权限");
    } elseif (!$web_admin && $rs[uid] != $lfjuid && $rs[cuid] != $lfjuid) {
        die("你没权限");
    }
    //删除评论要扣除积分
    if (!$web_admin && $rs[uid] != $lfjuid && $webdb[DelOtherCommentMoney]) {
        $lfjdb[money] = get_money($lfjdb[uid]);
        if (abs($webdb[DelOtherCommentMoney]) > $lfjdb[money]) {
コード例 #10
0
ファイル: s_rpc.php プロジェクト: GHubgenius/qbbj
<?php

require_once dirname(__FILE__) . "/" . "global.php";
header('Content-Type: text/html; charset=gb2312');
require_once ROOT_PATH . "inc/class.chinese.php";
$cnvert = new Chinese("UTF8", "GB2312", $_POST['queryString'], ROOT_PATH . "./inc/gbkcode/");
$_POST['queryString'] = $cnvert->ConvertIT();
$queryString = $_POST['queryString'];
if (strlen($queryString) > 0) {
    $query = $db->query("SELECT title FROM {$pre}article WHERE title LIKE '{$queryString}%' ORDER BY hits DESC LIMIT 10");
    while ($result = $db->fetch_array($query)) {
        echo '<li onClick="fill(\'' . $result[title] . '\');">' . $result[title] . '</li>';
    }
}
コード例 #11
0
ファイル: Sample.php プロジェクト: holin/sstour
echo $string;
echo "GB->Big5 from URL html<br>";
$chs = new Chinese("GB2312", "BIG5", "", $codeTablesDir);
$chs->OpenFile("http://mail.21cn.com/jffs/help.html", true);
$string = $chs->ConvertIT();
//eregi("href[[:space:]]*=[[:space:]]*(.*)[[:space:]]", $ret, $ctemp);
//echo $ctemp;
//$string = "<a href=www.testing.com>testing</a>";
//echo $string;
$string = eregi_replace("href=\"", "href=\"http://mail.21cn.com/jffs/", $string);
//	$string = eregi_replace("member.php?action=reg", "http://omega.idv.tw/kdb120/member.php?action=reg", $string);
//echo eregi_replace("href[[:space:]]*=[[:space:]]*(^[^http]+)([^>]+)>", "\\2", $string);
//echo eregi("<a[[:space:]]+href[[:space:]]*=[[:space:]]*([^>]+)>([[:alnum:]]+)<[[:space:]]*/a[[:space:]]*>", $string, eregi_replace("\\1", "", "\\1"));
//if (substr($regexp[1], 0, 4) != "http") {
//	$string = eregi_replace($regexp[1], "http://omega.idv.tw/kdb120/".$regexp[1], $string);
//}
//print_r ($regexp);
//$string = "<a href=\"www.testing.com\">testing</a>";
//$string = eregi_replace("member.php", "http://omega.idv.tw/kdb120/member.php", $string);
echo $string;
echo "UTF8->Big5 base64<br>";
$r = base64_decode("6L+U5Zue6L2J5o+b5b6M55qE57WQ5p6c");
//echo $r;
$chs = new Chinese("UTF8", "BIG5", $r);
$string = $chs->ConvertIT();
echo $string;
echo "UTF8->GB base64<br>";
$r = base64_decode("5oiR5ZKM5L2g5LiA6LW355qELDEyMw==");
$chs = new Chinese("UTF8", "GB2312", trim($r));
echo $chs->ConvertIT();
コード例 #12
0
ファイル: function.inc.php プロジェクト: xubo245/liuyangzhang
function ipfrom($ip)
{
    if (!preg_match("/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\$/", $ip)) {
        return '';
    }
    if (!is_file(ROOT_PATH . 'inc/ip.dat')) {
        return '<a title><A HREF="http://down.qibosoft.com/ip.rar" title="µã»÷ÏÂÔغó,½âѹ·Åµ½ÕûÕ¾/inc/Ŀ¼¼´¿É">IP¿â²»´æÔÚ,Çëµã»÷ÏÂÔØÒ»¸ö!</A></a>';
    }
    if ($fd = @fopen(ROOT_PATH . 'inc/ip.dat', 'rb')) {
        $ip = explode('.', $ip);
        $ipNum = $ip[0] * 16777216 + $ip[1] * 65536 + $ip[2] * 256 + $ip[3];
        $DataBegin = fread($fd, 4);
        $DataEnd = fread($fd, 4);
        $ipbegin = implode('', unpack('L', $DataBegin));
        if ($ipbegin < 0) {
            $ipbegin += pow(2, 32);
        }
        $ipend = implode('', unpack('L', $DataEnd));
        if ($ipend < 0) {
            $ipend += pow(2, 32);
        }
        $ipAllNum = ($ipend - $ipbegin) / 7 + 1;
        $BeginNum = 0;
        $EndNum = $ipAllNum;
        while ($ip1num > $ipNum || $ip2num < $ipNum) {
            $Middle = intval(($EndNum + $BeginNum) / 2);
            fseek($fd, $ipbegin + 7 * $Middle);
            $ipData1 = fread($fd, 4);
            if (strlen($ipData1) < 4) {
                fclose($fd);
                return '- System Error';
            }
            $ip1num = implode('', unpack('L', $ipData1));
            if ($ip1num < 0) {
                $ip1num += pow(2, 32);
            }
            if ($ip1num > $ipNum) {
                $EndNum = $Middle;
                continue;
            }
            $DataSeek = fread($fd, 3);
            if (strlen($DataSeek) < 3) {
                fclose($fd);
                return '- System Error';
            }
            $DataSeek = implode('', unpack('L', $DataSeek . chr(0)));
            fseek($fd, $DataSeek);
            $ipData2 = fread($fd, 4);
            if (strlen($ipData2) < 4) {
                fclose($fd);
                return '- System Error';
            }
            $ip2num = implode('', unpack('L', $ipData2));
            if ($ip2num < 0) {
                $ip2num += pow(2, 32);
            }
            if ($ip2num < $ipNum) {
                if ($Middle == $BeginNum) {
                    fclose($fd);
                    return '- Unknown';
                }
                $BeginNum = $Middle;
            }
        }
        $ipFlag = fread($fd, 1);
        if ($ipFlag == chr(1)) {
            $ipSeek = fread($fd, 3);
            if (strlen($ipSeek) < 3) {
                fclose($fd);
                return '- System Error';
            }
            $ipSeek = implode('', unpack('L', $ipSeek . chr(0)));
            fseek($fd, $ipSeek);
            $ipFlag = fread($fd, 1);
        }
        if ($ipFlag == chr(2)) {
            $AddrSeek = fread($fd, 3);
            if (strlen($AddrSeek) < 3) {
                fclose($fd);
                return '- System Error';
            }
            $ipFlag = fread($fd, 1);
            if ($ipFlag == chr(2)) {
                $AddrSeek2 = fread($fd, 3);
                if (strlen($AddrSeek2) < 3) {
                    fclose($fd);
                    return '- System Error';
                }
                $AddrSeek2 = implode('', unpack('L', $AddrSeek2 . chr(0)));
                fseek($fd, $AddrSeek2);
            } else {
                fseek($fd, -1, SEEK_CUR);
            }
            while (($char = fread($fd, 1)) != chr(0)) {
                $ipAddr2 .= $char;
            }
            $AddrSeek = implode('', unpack('L', $AddrSeek . chr(0)));
            fseek($fd, $AddrSeek);
            while (($char = fread($fd, 1)) != chr(0)) {
                $ipAddr1 .= $char;
            }
        } else {
            fseek($fd, -1, SEEK_CUR);
            while (($char = fread($fd, 1)) != chr(0)) {
                $ipAddr1 .= $char;
            }
            $ipFlag = fread($fd, 1);
            if ($ipFlag == chr(2)) {
                $AddrSeek2 = fread($fd, 3);
                if (strlen($AddrSeek2) < 3) {
                    fclose($fd);
                    return '- System Error';
                }
                $AddrSeek2 = implode('', unpack('L', $AddrSeek2 . chr(0)));
                fseek($fd, $AddrSeek2);
            } else {
                fseek($fd, -1, SEEK_CUR);
            }
            while (($char = fread($fd, 1)) != chr(0)) {
                $ipAddr2 .= $char;
            }
        }
        fclose($fd);
        if (preg_match('/http/i', $ipAddr2)) {
            $ipAddr2 = '';
        }
        $ipaddr = "{$ipAddr1} {$ipAddr2}";
        $ipaddr = preg_replace('/CZ88\\.NET/is', '', $ipaddr);
        $ipaddr = preg_replace('/^\\s*/is', '', $ipaddr);
        $ipaddr = preg_replace('/\\s*$/is', '', $ipaddr);
        if (preg_match('/http/i', $ipaddr) || $ipaddr == '') {
            $ipaddr = '- Unknown';
        }
        if (WEB_LANG == 'big5') {
            require_once ROOT_PATH . "inc/class.chinese.php";
            $cnvert = new Chinese("GB2312", "BIG5", $ipaddr, ROOT_PATH . "./inc/gbkcode/");
            $ipaddr = $cnvert->ConvertIT();
        } elseif (WEB_LANG == 'utf-8') {
            require_once ROOT_PATH . "inc/class.chinese.php";
            $cnvert = new Chinese("GB2312", "UTF8", $ipaddr, ROOT_PATH . "./inc/gbkcode/");
            $ipaddr = $cnvert->ConvertIT();
        }
        return $ipaddr;
    }
}
コード例 #13
0
ファイル: Sample_temp.php プロジェクト: holin/sstour
<?php

// 码表所在目录。当class.Chinese.php与引用者不在同一目录下时,就应该对这个参数进行设置。
$codeTablesDir = "./config/";
include "class.Chinese.php";
/*
echo "UTF8->Big5 base64<br>";
$r = base64_decode("6L+U5Zue6L2J5o+b5b6M55qE57WQ5p6c");
//echo $r;
$chs = new Chinese("UTF8","BIG5",$r);
$string = $chs->ConvertIT();
echo $string;

echo "UTF8->GB base64<br>";
$r = base64_decode("5oiR5ZKM5L2g5LiA6LW355qELDEyMw==");
$chs = new Chinese("UTF8","GB2312", trim($r) );
echo $chs->ConvertIT();
*/
$cnvert = new Chinese("GB2312", "UTF8", "WEB2.0");
echo $cnvert->ConvertIT() . "<br />";
コード例 #14
0
ファイル: Chart.php プロジェクト: iwater/kissphp
 /**
  * GB2312转UNICODE
  *
  * @param string $pString 原始字串
  *
  * @return string
  */
 private function _gb2312ToUNICODE($pString)
 {
     if (!empty($pString)) {
         $chs = new Chinese("GB2312", "UNICODE", $pString);
         $string = $chs->ConvertIT();
         return preg_replace("/&#x([0-9A-F]{4});/", "%u\$1", $string);
     }
     return "";
 }
コード例 #15
0
ファイル: JChinese.php プロジェクト: robhagemans/yii-chinese
 public function convert($text)
 {
     $this->setSourceText($text);
     return parent::ConvertIT();
 }
コード例 #16
0
ファイル: fontimg.php プロジェクト: GHubgenius/qbbj
<?php

require_once dirname(__FILE__) . "/../inc/" . "class.chinese.php";
$c = $_GET[c];
$x = $_GET[x];
$y = $_GET[y];
$str = urldecode($_GET[str]);
$size = $_GET[size];
$image = '../' . $_GET[image];
if (!getimagesize(dirname(__FILE__) . "/{$image}")) {
    $image = "../images/showsp/topimg.jpg";
}
$fnt = dirname(__FILE__) . "/../inc/" . "font.ttf";
$str || ($str = "ÇëÊäÈë×ÖÌå!");
$cnvert = new Chinese("GB2312", "UTF8", $str, dirname(__FILE__) . "/../inc/" . "gbkcode/");
$str = $cnvert->ConvertIT();
$size || ($size = 30);
$img_array = getimagesize($image);
$font_array = ImageTTFBBox($size, 0, $fnt, $str);
$font_wight = intval($font_array[2] - $font_array[0]);
$font_height = intval($font_array[3] - $font_array[5]);
$x || ($x = intval(($img_array[0] - $font_wight) / 2));
$y || ($y = intval($img_array[1] / 2 + $font_height / 2));
$im = imagecreatefromjpeg($image);
if ($c == 'blue') {
    $color = imagecolorclosestalpha($im, 00, 00, 255, 20);
    $color2 = imagecolorclosestalpha($im, 00, 00, 00, 98);
    imagettftext($im, $size, 0, $x + 2, $y + 2, $color2, $fnt, $str);
} elseif ($c == 'white') {
    $color = imagecolorclosestalpha($im, 255, 255, 255, 20);
    $color2 = imagecolorclosestalpha($im, 00, 00, 00, 99);