Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
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;
}
Ejemplo n.º 4
0
 public function get_payment_code($payment_notice_id)
 {
     $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
     //$order = $GLOBALS['db']->getRow("select order_sn,bank_id from ".DB_PREFIX."deal_order where id = ".$payment_notice['order_id']);
     $order_sn = $payment_notice['notice_sn'];
     $money = round($payment_notice['money'], 2);
     $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id']));
     $payment_info['config'] = unserialize($payment_info['config']);
     /*$data_front_url =  SITE_DOMAIN.APP_ROOT.'/index.php?ctl=payment&act=notify&class_name=Guofubao';
       $data_front_url="";
       $data_return_url = SITE_DOMAIN.APP_ROOT.'/index.php?ctl=payment&act=response&class_name=Guofubao';
       */
     //新
     $data_front_url = SITE_DOMAIN . APP_ROOT . '/callback/pay/guofubao_callback.php?act=notify';
     //$data_front_url="";
     $data_return_url = SITE_DOMAIN . APP_ROOT . '/callback/pay/guofubao_callback.php?act=response';
     $tranCode = '8888';
     //$spbill_create_ip = $_SERVER['REMOTE_ADDR'];
     $spbill_create_ip = CLIENT_IP;
     /* 交易日期 */
     $today = to_date($payment_notice['create_time'], 'YmdHis');
     $bank_id = $payment_notice['bank_id'];
     if ($bank_id == '0') {
         $bank_id = '';
     }
     $desc = $order_sn;
     include_once APP_ROOT_PATH . "system/libs/iconv.php";
     $chinese = new Chinese();
     $desc = $chinese->Convert("UTF-8", "GBK", $desc);
     /* 货币类型 */
     $currencyType = '156';
     /* 数字签名 */
     $version = '2.1';
     $tranCode = $tranCode;
     $merchant_id = $payment_info['config']['merchant_id'];
     $merOrderNum = $order_sn;
     $tranAmt = $money;
     // 总金额
     $feeAmt = '';
     $tranDateTime = $today;
     $frontMerUrl = $data_front_url;
     $backgroundMerUrl = $data_return_url;
     //返回的路径
     $tranIP = $spbill_create_ip != "" ? $spbill_create_ip : '';
     //商户识别码
     $verficationCode = $payment_info['config']['VerficationCode'];
     $gopayServerTime = trim(file_get_contents("https://www.gopay.com.cn/PGServer/time"));
     $signValue = 'version=[' . $version . ']tranCode=[' . $tranCode . ']merchantID=[' . $merchant_id . ']merOrderNum=[' . $merOrderNum . ']tranAmt=[' . $tranAmt . ']feeAmt=[' . $feeAmt . ']tranDateTime=[' . $tranDateTime . ']frontMerUrl=[' . $frontMerUrl . ']backgroundMerUrl=[' . $backgroundMerUrl . ']orderId=[]gopayOutOrderId=[]tranIP=[' . $tranIP . ']respCode=[]gopayServerTime=[' . $gopayServerTime . ']VerficationCode=[' . $verficationCode . ']';
     $signValue = md5($signValue);
     /*交易参数*/
     $parameter = array('version' => '2.1', 'charset' => '2', 'language' => '1', 'signType' => '1', 'tranCode' => '8888', 'merchantID' => $merchant_id, 'virCardNoIn' => $payment_info['config']['virCardNoIn'], 'merOrderNum' => $merOrderNum, 'tranAmt' => $tranAmt, 'currencyType' => $currencyType, 'tranDateTime' => $tranDateTime, 'tranIP' => $spbill_create_ip, 'goodsName' => $desc, 'goodsDetail' => '', 'buyerName' => '', 'buyerContact' => '', 'frontMerUrl' => $frontMerUrl, 'backgroundMerUrl' => $backgroundMerUrl, 'signValue' => $signValue, 'gopayServerTime' => $gopayServerTime, 'bankCode' => $bank_id, 'userType' => 1, 'feeAmt' => '', 'isRepeatSubmit' => '', 'merRemark1' => $payment_notice_id, 'merRemark2' => '');
     $def_url = '<form style="text-align:center;" action="https://gateway.gopay.com.cn/Trans/WebClientAction.do" target="_blank" style="margin:0px;padding:0px" method="get" >';
     foreach ($parameter as $key => $val) {
         $def_url .= "<input type='hidden' name='{$key}' value='{$val}' />";
     }
     $def_url .= "<input type='submit' class='paybutton' value='前往国付宝在线支付' />";
     $def_url .= "</form>";
     $def_url .= "<br /><div style='text-align:center' class='red'>" . $GLOBALS['lang']['PAY_TOTAL_PRICE'] . ":" . format_price($money) . "</div>";
     return $def_url;
 }
Ejemplo n.º 5
0
function _iconv($s, $t, $data)
{
    if (function_exists('iconv')) {
        return iconv($s, $t, $data);
    } else {
        require_once 'chinese.class.php';
        $chs = new Chinese($s, $t);
        return $chs->convert($data);
    }
}
Ejemplo n.º 6
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;
}
Ejemplo n.º 7
0
function webim_from_utf8($charset, $str)
{
    if (strtoupper($charset) == 'UTF-8') {
        return $str;
    }
    if (function_exists('iconv')) {
        return iconv('utf-8', $charset, $str);
    }
    require_once dirname(__FILE__) . '/class_chinese.php';
    $chs = new Chinese('utf-8', $charset);
    return $chs->Convert($str);
}
Ejemplo n.º 8
0
function jsprocdata($data, $requestcharset)
{
    global $boardurl, $_DCACHE, $charset;
    if ($requestcharset) {
        include DISCUZ_ROOT . 'include/chinese.class.php';
        if (strtoupper($charset) != 'UTF-8') {
            $c = new Chinese($charset, 'utf8');
        } else {
            $c = new Chinese('utf8', $requestcharset == 1 ? 'gbk' : 'big5');
        }
        $data = $c->Convert($data);
    }
    return 'document.write(\'' . preg_replace("/\r\n|\n|\r/", '\\n', addcslashes($data, "'\\")) . '\');';
}
Ejemplo n.º 9
0
 public function big52utf8($string)
 {
     $string = mb_convert_encoding($string, "UTF-8", "BIG5");
     $string = Chinese::decimal_notation_converting($string);
     $string = $this->stringRevise($string);
     return $string;
 }
Ejemplo n.º 10
0
function wap_footer()
{
    global $wind_version, $db_obstart, $windid, $db_charset, $db_wapcharset, $prog, $chs;
    require_once PrintEot('wap_footer');
    $output = ob_get_contents();
    ob_end_clean();
    $db_obstart && function_exists('ob_gzhandler') ? ob_start('ob_gzhandler') : ob_start();
    if ($db_charset != 'utf8') {
        $chs = new Chinese();
        $output = $chs->Convert($output, $db_charset, $db_wapcharset ? 'UTF8' : 'UNICODE');
    }
    $output = str_replace(array('<!--<!---->', '<!---->'), '', $output);
    echo $output;
    flush();
    exit;
}
Ejemplo n.º 11
0
 public function big52utf8($str)
 {
     //$str = mb_convert_encoding($str, "UTF-8", "BIG5");
     $str = parent::big52utf8($str);
     //$str = $this->strRevise($str);
     return $str;
 }
Ejemplo n.º 12
0
function get_seo_info($domain, $che)
{
    global $ROBOT;
    $che = explode(',', $che);
    $ch = array_combine($che, $che);
    $content = '';
    $site_info = '';
    $link_info = '';
    $jobs = array();
    $jobs[1] = "baidu";
    $jobs[2] = "google";
    $jobs[3] = "yahoo";
    $jobs[4] = "soso";
    $jobs[5] = "vnet";
    $jobs[6] = "so163";
    $jobs[7] = "sogou";
    $a = '<table border=1 width=100% bordercolordark=#FFFFFF cellspacing=0 cellpadding=0 bordercolorlight=#BBD7E6>	<tr bgcolor=#D8F0FC><td colspan=9>网址<a href=http://' . $domain . ' target=_blank>http://' . $domain . '</a>在各大搜索引擎的收录查询结果</td></tr><tr><td>搜索引擎</td>';
    for ($i = 1; $i <= sizeof($jobs); $i++) {
        if ($ch[$i]) {
            $a .= "<td>" . $ROBOT[$jobs[$i]]['name'] . "</td>";
        }
    }
    $a .= "</tr><tr><td>收录数量</td>";
    for ($i = 1; $i <= sizeof($jobs); $i++) {
        if ($ch[$i]) {
            eval('$__file__=__FILE__;');
            define('ROOT_PATH', $__file__ ? dirname($__file__) . '/' : './');
            $content[$i] = get_content($ROBOT[$jobs[$i]]['site_url'] . $domain);
            if ($i == 3 || $i == 5 || $i == 6) {
                require_once 'require/chinese.php';
                $chs = new Chinese('utf-8', 'GB2312');
                $content[$i] = $chs->Convert($content[$i]);
            }
            if (empty($content[$i])) {
                return 'Unkown Error...';
            }
            if (preg_match($ROBOT[$jobs[$i]]['site_pattern'], $content[$i], $matches[$i])) {
                $site_info[$i] = $matches[$i][1];
            }
            $site_info[$i] = $site_info[$i] ? $site_info[$i] : '--';
            $a .= '<td><a href="' . $ROBOT[$jobs[$i]]['site_url'] . $domain . '" target="_blank">' . $site_info[$i] . '</a></td>';
        }
    }
    $a .= "</tr><tr><td>相关查询</td><td colspan=7 align=left><a href=../ip/index.php?domain=" . $domain . " target=_blank>IP地址查询</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=../pr/pr.php?domain=" . $domain . " target=_blank>PR查询</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=../whois/index.php?domain=" . $domain . " target=_blank>域名Whois查询</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=/alexa target=_blank>Alexa排名查询</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=../friends/friends.php?domain=" . $domain . " target=_blank>友情链接查询</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=../friendlink/friendlink.php?domain=" . $domain . " target=_blank>友情链接IP查询</a></td></tr></table>";
    return $a;
}
Ejemplo n.º 13
0
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);
}
Ejemplo n.º 14
0
function insenz_convert($str, $type = 1)
{
    global $charset, $discuz_chs, $insenz_chs;
    if ($charset != 'utf-8') {
        require_once DISCUZ_ROOT . './include/chinese.class.php';
        if ($type) {
            if (!$insenz_chs) {
                $insenz_chs = new Chinese($charset, 'utf-8', TRUE);
            }
            $str = $insenz_chs->convert($str);
        } else {
            if (!$discuz_chs) {
                $discuz_chs = new Chinese('utf-8', $charset, TRUE);
            }
            $str = $discuz_chs->convert($str);
        }
    }
    return $type ? htmlspecialchars($str) : addslashes($str);
}
Ejemplo n.º 15
0
 function _buildResult($result, $index)
 {
     require_once R_P . 'm/chinese.php';
     $chs = new Chinese('utf8', 'gbk');
     foreach ($result["words"] as $word => $info) {
         $words[] = $chs->Convert($word);
     }
     $totals = $result['total'];
     if (is_array($result["matches"])) {
         $tids = '';
         foreach ($result["matches"] as $docinfo) {
             $tids && ($tids .= ',');
             if (strpos($index, 'tmsgs') !== false || strpos($index, 'threads') !== false) {
                 $tids .= $docinfo['id'];
             } else {
                 $tids .= $docinfo['attrs']['tid'];
             }
         }
         return array($totals, $tids, $words);
     } else {
         return false;
     }
 }
Ejemplo n.º 16
0
 public function big52utf8($str)
 {
     $str = parent::big52utf8($str);
     $i = 1;
     while ($i != 0) {
         //print $string;
         $pattern = '/&#\\d+\\;/';
         preg_match($pattern, $str, $matches);
         $i = sizeof($matches);
         if ($i != 0) {
             $unicode_char = mb_convert_encoding($matches[0], 'UTF-8', 'HTML-ENTITIES');
             $str = preg_replace("/{$matches['0']}/", $unicode_char, $string);
         }
         //end if
     }
     return $str;
 }
Ejemplo n.º 17
0
function ecs_iconv($source_lang, $target_lang, $source_string = '')
{
    static $chs = NULL;

    /* 如果字符串为空或者字符串不需要转换,直接返回 */
    if ($source_lang == $target_lang || $source_string == '' || preg_match("/[\x80-\xFF]+/", $source_string) == 0)
    {
        return $source_string;
    }

    if ($chs === NULL)
    {
        require_once(ROOT_PATH . 'includes/cls_iconv.php');
        $chs = new Chinese(ROOT_PATH);
    }

    return $chs->Convert($source_lang, $target_lang, $source_string);
}
Ejemplo n.º 18
0
function seccode_ttffont()
{
    global $seccode, $seccodedata, $im, $c, $charset;
    $seccoderoot = $seccodedata['type'] ? 'images/fonts/ch/' : 'images/fonts/en/';
    $dirs = opendir($seccoderoot);
    $seccodettf = array();
    while ($entry = readdir($dirs)) {
        if ($entry != '.' && $entry != '..' && strtolower(fileext($entry)) == 'ttf') {
            $seccodettf[] = $entry;
        }
    }
    $seccodelength = 4;
    if ($seccodedata['type'] && !empty($seccodettf)) {
        if (strtoupper($charset) != 'UTF-8') {
            include DISCUZ_ROOT . 'include/chinese.class.php';
            $cvt = new Chinese($charset, 'utf8');
            $seccode = $cvt->Convert($seccode);
        }
        $seccode = array(substr($seccode, 0, 3), substr($seccode, 3, 3));
        $seccodelength = 2;
    }
    $widthtotal = 0;
    for ($i = 0; $i < $seccodelength; $i++) {
        $font[$i]['font'] = $seccoderoot . $seccodettf[array_rand($seccodettf)];
        $font[$i]['angle'] = $seccodedata['angle'] ? mt_rand(-30, 30) : 0;
        $font[$i]['size'] = $seccodedata['type'] ? $seccodedata['width'] / 7 : $seccodedata['width'] / 6;
        $seccodedata['size'] && ($font[$i]['size'] = mt_rand($font[$i]['size'] - $seccodedata['width'] / 40, $font[$i]['size'] + $seccodedata['width'] / 20));
        $box = imagettfbbox($font[$i]['size'], 0, $font[$i]['font'], $seccode[$i]);
        $font[$i]['zheight'] = max($box[1], $box[3]) - min($box[5], $box[7]);
        $box = imagettfbbox($font[$i]['size'], $font[$i]['angle'], $font[$i]['font'], $seccode[$i]);
        $font[$i]['height'] = max($box[1], $box[3]) - min($box[5], $box[7]);
        $font[$i]['hd'] = $font[$i]['height'] - $font[$i]['zheight'];
        $font[$i]['width'] = max($box[2], $box[4]) - min($box[0], $box[6]) + mt_rand(0, $seccodedata['width'] / 8);
        $font[$i]['width'] = $font[$i]['width'] > $seccodedata['width'] / $seccodelength ? $seccodedata['width'] / $seccodelength : $font[$i]['width'];
        $widthtotal += $font[$i]['width'];
    }
    $x = mt_rand($font[0]['angle'] > 0 ? cos(deg2rad(90 - $font[0]['angle'])) * $font[0]['zheight'] : 1, $seccodedata['width'] - $widthtotal);
    !$seccodedata['color'] && ($text_color = imagecolorallocate($im, $c[0], $c[1], $c[2]));
    for ($i = 0; $i < $seccodelength; $i++) {
        if ($seccodedata['color']) {
            $c = array(mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
            $seccodedata['shadow'] && ($text_shadowcolor = imagecolorallocate($im, 255 - $c[0], 255 - $c[1], 255 - $c[2]));
            $text_color = imagecolorallocate($im, $c[0], $c[1], $c[2]);
        } elseif ($seccodedata['shadow']) {
            $text_shadowcolor = imagecolorallocate($im, 255 - $c[0], 255 - $c[1], 255 - $c[2]);
        }
        $y = $font[0]['angle'] > 0 ? mt_rand($font[$i]['height'], $seccodedata['height']) : mt_rand($font[$i]['height'] - $font[$i]['hd'], $seccodedata['height'] - $font[$i]['hd']);
        $seccodedata['shadow'] && imagettftext($im, $font[$i]['size'], $font[$i]['angle'], $x + 1, $y + 1, $text_shadowcolor, $font[$i]['font'], $seccode[$i]);
        imagettftext($im, $font[$i]['size'], $font[$i]['angle'], $x, $y, $text_color, $font[$i]['font'], $seccode[$i]);
        $x += $font[$i]['width'];
    }
}
Ejemplo n.º 19
0
function diconv($str, $in_charset, $out_charset = CHARSET, $ForceTable = FALSE)
{
    global $_G;
    $in_charset = strtoupper($in_charset);
    $out_charset = strtoupper($out_charset);
    if (empty($str) || $in_charset == $out_charset) {
        return $str;
    }
    $out = '';
    if (!$ForceTable) {
        if (function_exists('iconv')) {
            $out = iconv($in_charset, $out_charset . '//IGNORE', $str);
        } elseif (function_exists('mb_convert_encoding')) {
            $out = mb_convert_encoding($str, $out_charset, $in_charset);
        }
    }
    if ($out == '') {
        $chinese = new Chinese($in_charset, $out_charset, true);
        $out = $chinese->Convert($str);
    }
    return $out;
}
Ejemplo n.º 20
0
 /**
  * 导出csv文件
  *
  * @param array $data 数据(如果需要,列标题也包含在这里)
  * @param string $filename 文件名(不含扩展名)
  * @param string $to_charset 目标编码
  */
 function export_to_csv($data, $filename, $to_charset = '')
 {
     if ($to_charset && $to_charset != 'utf-8') {
         $need_convert = true;
         import('iconv.lib');
         $iconv = new Chinese(ROOT_PATH . '/');
     } else {
         $need_convert = false;
     }
     header("Content-type: application/unknown");
     header("Content-Disposition: attachment; filename={$filename}.csv");
     foreach ($data as $row) {
         foreach ($row as $key => $col) {
             if ($need_convert) {
                 $col = $iconv->Convert('utf-8', $to_charset, $col);
             }
             $row[$key] = $this->_replace_special_char($col);
         }
         echo join(',', $row) . "\r\n";
     }
 }
Ejemplo n.º 21
0
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>';
Ejemplo n.º 22
0
function invite_payurl($amount, $price, &$orderid, $bank = 'DEFAULT')
{
    include_once DISCUZ_ROOT . './source/class/class_chinese.php';
    global $_G;
    $date = dgmdate(TIMESTAMP, 'YmdHis');
    $suffix = dgmdate(TIMESTAMP, 'His') . rand(1000, 9999);
    $transaction_id = DISCUZ_PARTNER . $date . $suffix;
    $orderid = dgmdate(TIMESTAMP, 'YmdHis') . random(14);
    $chinese = new Chinese(strtoupper(CHARSET), 'GBK');
    $subject = $chinese->Convert(lang('forum/misc', 'invite_forum_payment') . '_' . intval($amount) . '_' . lang('forum/misc', 'invite_forum_payment_unit') . '_(' . $_G['clientip'] . ')');
    $reqHandler = new RequestHandler();
    $reqHandler->setGateURL("https://gw.tenpay.com/gateway/pay.htm");
    $reqHandler->init();
    $reqHandler->setKey(DISCUZ_SECURITYCODE);
    $reqHandler->setParameter("partner", DISCUZ_PARTNER);
    $reqHandler->setParameter("out_trade_no", $orderid);
    $reqHandler->setParameter("total_fee", $price * 100);
    $reqHandler->setParameter("return_url", $_G['siteurl'] . 'api/trade/notify_invite.php');
    $reqHandler->setParameter("notify_url", $_G['siteurl'] . 'api/trade/notify_invite.php');
    $reqHandler->setParameter("body", $subject);
    $reqHandler->setParameter("bank_type", $bank);
    $reqHandler->setParameter("spbill_create_ip", $_G['clientip']);
    $reqHandler->setParameter("fee_type", "1");
    $reqHandler->setParameter("subject", $subject);
    $reqHandler->setParameter("sign_type", "MD5");
    $reqHandler->setParameter("service_version", "1.0");
    $reqHandler->setParameter("input_charset", "GBK");
    $reqHandler->setParameter("sign_key_index", "1");
    $reqHandler->setParameter("attach", "tenpay");
    $reqHandler->setParameter("time_start", $date);
    $reqHandler->setParameter("trade_mode", "1");
    $reqHandler->setParameter("trans_type", "1");
    $reqHandler->setParameter("agentid", DISCUZ_AGENTID);
    $reqHandler->setParameter("agent_type", "2");
    $reqUrl = $reqHandler->getRequestURL();
    return $reqUrl;
}
Ejemplo n.º 23
0
 public function display($tpl_file, $cache_fileID = null, $html = false, $htmFile = null, $lng = 'cn', $xml_fileex = null)
 {
     $this->lng = $lng;
     if (!empty($xml_fileex)) {
         $tpl_file = $this->templatesDIR . $tpl_file . $xml_fileex;
     } else {
         $tpl_file = $this->templatesDIR . $tpl_file . $this->templatesfileex;
     }
     if (!is_dir($this->tpl_dir) || !is_dir($this->tpl_c_dir)) {
         exit('Error[2]:Please set up correctly TemplateDIR and CacheDIR');
     }
     $template_file = $this->tpl_dir . $tpl_file;
     if (!file_exists($template_file)) {
         exit('Error[3]:Template file does not exist,Path:' . $tpl_file);
     }
     if ($this->caching) {
         if (!is_dir($this->cache_dir)) {
             exit('Error[4]:Please correct cacheDIR settings');
         }
     } else {
     }
     $out = $this->fetch($tpl_file, $cache_fileID);
     if (strpos($out, $this->_linkechash)) {
         $includefile = explode($this->_linkechash, $out);
         foreach ($includefile as $key => $val) {
             if ($key % 2 == 1) {
                 $val = str_replace('|', '', $val);
                 $includefile[$key] = $this->fetch($val);
             }
         }
         $out = implode('', $includefile);
     }
     if (strpos($out, $this->_includeechash)) {
         $includefile = explode($this->_includeechash, $out);
         foreach ($includefile as $key => $val) {
             if ($key % 2 == 1) {
                 $val = str_replace('|', '', $val);
                 $includefile[$key] = $this->fetch($val);
             }
         }
         $out = implode('', $includefile);
     }
     if (strpos($out, $this->gethash)) {
         $getout = explode($this->gethash, $out);
         foreach ($getout as $key => $val) {
             if ($key % 2 == 1) {
                 $getvalue = explode($this->gethashtable, $val);
                 list($getval, $tempbreak) = $getvalue;
                 $getout[$key] = $this->insert_get_mod($getval, $tempbreak);
             }
         }
         $out = implode('', $getout);
     }
     if (strpos($out, $this->_echash)) {
         $k = explode($this->_echash, $out);
         foreach ($k as $key => $val) {
             if ($key % 2 == 1) {
                 $k[$key] = $this->insert_mod($val);
             }
         }
         $out = implode('', $k);
         $out = $this->format_js($out);
     }
     if (strpos($out, $this->_listechash)) {
         $k = explode($this->_listechash, $out);
         foreach ($k as $key => $val) {
             if ($key % 2 == 1) {
                 $k[$key] = $this->insert_mod($val);
             }
         }
         $out = implode('', $k);
         $out = $this->format_js($out);
     }
     if (strpos($out, $this->findhash)) {
         $findout = explode($this->findhash, $out);
         foreach ($findout as $key => $val) {
             if ($key % 2 == 1) {
                 $filevalue = explode('|', $val);
                 list($findmodel, $findclass, $findfiled) = $filevalue;
                 $findout[$key] = $this->insert_find_mod($findmodel, $findclass, $findfiled);
             }
         }
         $out = implode('', $findout);
     }
     if ($this->lng == 'big5') {
         $out = $this->protection($out);
         require_once admin_ROOT . 'public/class.Chinese.php';
         $codechange = new Chinese(admin_ROOT . 'public/config/');
         ob_start();
         eval('?' . '>' . trim($out));
         $name = ob_get_contents();
         ob_end_clean();
         $out = $codechange->g2b($name);
         if ($html) {
             ob_start();
             echo $out;
             $content = ob_get_contents();
             ob_end_clean();
             $this->cachefilewrite($htmFile, $content);
         } else {
             echo $out;
         }
     } else {
         $out = $this->protection($out);
         if ($html) {
             ob_start();
             eval('?' . '>' . trim($out));
             $content = ob_get_contents();
             ob_end_clean();
             $this->cachefilewrite($htmFile, $content);
         } else {
             eval('?' . '>' . trim($out));
         }
     }
 }
Ejemplo n.º 24
0
 function convert($str, $to_encoding, $from_encoding)
 {
     if (function_exists('mb_convert_encoding')) {
         return mb_convert_encoding($str, $to_encoding, $from_encoding);
     } else {
         require_once R_P . 'm/chinese.php';
         $chs = new Chinese($from_encoding, $to_encoding);
         return $chs->Convert($str);
     }
 }
Ejemplo n.º 25
0
function stringtopic($value, $key = '', $force = false, $rlength = 0)
{
    if ($key === '') {
        $key = $value;
    }
    $basedir = !getglobal('setting/attachdir') ? './data/attachment' : getglobal('setting/attachdir');
    $url = !getglobal('setting/attachurl') ? './data/attachment/' : getglobal('setting/attachurl');
    $subdir1 = substr(md5($key), 0, 2);
    $subdir2 = substr(md5($key), 2, 2);
    $target = 'temp/' . $subdir1 . '/' . $subdir2 . '/';
    $targetname = substr(md5($key), 8, 16) . '.png';
    discuz_upload::check_dir_exists('temp', $subdir1, $subdir2);
    if (!$force && file_exists($basedir . '/' . $target . $targetname)) {
        return $url . $target . $targetname;
    }
    $value = str_replace("\n", '', $value);
    $fontfile = $fontname = '';
    $ttfenabled = false;
    $size = 10;
    $w = 130;
    $rowh = 25;
    $value = explode("\r", $value);
    if ($rlength) {
        $temp = array();
        foreach ($value as $str) {
            $strlen = dstrlen($str);
            if ($strlen > $rlength) {
                for ($i = 0; $i < $strlen; $i++) {
                    $sub = cutstr($str, $rlength, '');
                    $temp[] = $sub;
                    $str = substr($str, strlen($sub));
                    $strlen = $strlen - $rlength;
                }
            } else {
                $temp[] = $str;
            }
        }
        $value = $temp;
        unset($temp);
    }
    if (function_exists('imagettftext')) {
        $fontroot = DISCUZ_ROOT . './static/image/seccode/font/ch/';
        $dirs = opendir($fontroot);
        while ($entry = readdir($dirs)) {
            if ($entry != '.' && $entry != '..' && in_array(strtolower(fileext($entry)), array('ttf', 'ttc'))) {
                $fontname = $entry;
                break;
            }
        }
        if (!empty($fontname)) {
            $fontfile = DISCUZ_ROOT . './static/image/seccode/font/ch/' . $fontname;
        }
        if ($fontfile) {
            if (strtoupper(CHARSET) != 'UTF-8') {
                include DISCUZ_ROOT . './source/class/class_chinese.php';
                $cvt = new Chinese(CHARSET, 'utf8');
                $value = $cvt->Convert(implode("\r", $value));
                $value = explode("\r", $value);
            }
            $ttfenabled = true;
        }
    }
    foreach ($value as $str) {
        if ($ttfenabled) {
            $box = imagettfbbox($size, 0, $fontfile, $str);
            $height = max($box[1], $box[3]) - min($box[5], $box[7]);
            $len = max($box[2], $box[4]) - min($box[0], $box[6]);
            $rowh = max(array($height, $rowh));
        } else {
            $len = strlen($str) * 12;
        }
        $w = max(array($len, $w));
    }
    $h = $rowh * count($value) + count($value) * 2;
    $im = @imagecreate($w, $h);
    $background_color = imagecolorallocate($im, 255, 255, 255);
    $text_color = imagecolorallocate($im, 60, 60, 60);
    $h = $ttfenabled ? $rowh : 4;
    foreach ($value as $str) {
        if ($ttfenabled) {
            imagettftext($im, $size, 0, 0, $h, $text_color, $fontfile, $str);
            $h += 2;
        } else {
            imagestring($im, $size, 0, $h, $str, $text_color);
        }
        $h += $rowh;
    }
    imagepng($im, $basedir . '/' . $target . $targetname);
    imagedestroy($im);
    return $url . $target . $targetname;
}
Ejemplo n.º 26
0
/**
 * GBK字符串转utf8为字符串
 * @param string $str 要转换的字符串
 * @return void
 */
function gbToUTF8($str)
{
    static $chinese = NULL;
    if ($chinese === NULL) {
        require_once fimport('class/chinese');
        $chinese = new Chinese('GBK', 'UTF-8');
    }
    return $chinese->convert($str);
}
Ejemplo n.º 27
0
$tid = intval($_GET['tid']);
if ($_GET['verifykey'] != md5($_G['authkey'] . $tid . $subjectenc . CHARSET . $site)) {
    exit;
}
$tshow = !$_G['setting']['qihoo']['relate']['position'] ? 'mid' : 'bot';
$intnum = intval($_G['setting']['qihoo']['relate']['bbsnum']);
$extnum = intval($_G['setting']['qihoo']['relate']['webnum']);
$exttype = $_G['setting']['qihoo']['relate']['type'];
$up = intval($_GET['qihoo_up']);
$data = @implode('', file("http://related.code.qihoo.com/related.html?title={$subjectenc}&ics=" . CHARSET . "&ocs=" . CHARSET . "&site={$site}&sort=pdate&tshow={$tshow}&intnum={$intnum}&extnum={$extnum}&exttype={$exttype}&up={$up}"));
if ($data) {
    $timestamp = time();
    $chs = '';
    if (PHP_VERSION > '5' && CHARSET != 'utf-8') {
        require_once libfile('class/chinese');
        $chs = new Chinese('utf-8', CHARSET);
    }
    $parser = xml_parser_create();
    xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
    xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
    xml_parse_into_struct($parser, $data, $values, $index);
    xml_parser_free($parser);
    $xmldata = array('chanl', 'fid', 'title', 'tid', 'author', 'pdate', 'rdate', 'rnum', 'vnum', 'insite');
    $relatedthreadlist = $keywords = array();
    $nextuptime = 0;
    foreach ($index as $tag => $valuearray) {
        if (in_array($tag, $xmldata)) {
            foreach ($valuearray as $key => $value) {
                if ($values[$index['title'][$key]]['value']) {
                    $relatedthreadlist[$key][$tag] = !empty($chs) ? $chs->convert(trim($values[$value]['value'])) : trim($values[$value]['value']);
                    $relatedthreadlist[$key]['fid'] = !$values[$index['fid'][$key]]['value'] ? preg_replace("/(.+?)\\/forum\\-(\\d+)\\-(\\d+)\\.html/", "\\2", trim($values[$index['curl'][$key]]['value'])) : trim($values[$index['fid'][$key]]['value']);
Ejemplo n.º 28
0
    printerror('此充值类型需要 ' . $level_r[$buyr[buygroupid]][groupname] . ' 会员级别以上', '', 1, 0, 1);
}
include 'payfun.php';
$money = $buyr['gmoney'];
if (!$money) {
    printerror('此充值类型金额有误', '', 1, 0, 1);
}
$ddno = '';
$productname = "充值类型:" . $buyr['gname'] . ",UID:" . $user['userid'] . ",UName:" . $user['username'];
$productsay = "用户ID:" . $user['userid'] . ",用户名:" . $user['username'];
esetcookie("payphome", "BuyGroupPay", 0);
esetcookie("paymoneybgid", $id, 0);
//返回地址前缀
$PayReturnUrlQz = $public_r['newsurl'];
if (!stristr($public_r['newsurl'], '://')) {
    $PayReturnUrlQz = eReturnDomain() . $public_r['newsurl'];
}
//编码
if ($ecms_config['sets']['pagechar'] != 'gb2312') {
    @(include_once "../class/doiconv.php");
    $iconv = new Chinese('');
    $char = $ecms_config['sets']['pagechar'] == 'big5' ? 'BIG5' : 'UTF8';
    $targetchar = 'GB2312';
    $productname = $iconv->Convert($char, $targetchar, $productname);
    $productsay = $iconv->Convert($char, $targetchar, $productsay);
    @header('Content-Type: text/html; charset=gb2312');
}
$file = $payr['paytype'] . '/to_pay.php';
@(include $file);
db_close();
$empire = null;
Ejemplo n.º 29
0
function wmloutput()
{
    global $sid, $charset, $wapcharset;
    static $chs;
    $content = preg_replace("/\\<a(\\s*[^\\>]+\\s*)href\\=([\"|\\']?)([^\"\\'\\s]+)/ies", "transsid('\\3','<a\\1href=\\2',1)", ob_get_contents());
    ob_end_clean();
    if ($charset != 'utf-8') {
        $target = $wapcharset == 1 ? 'UTF-8' : 'UNICODE';
        if (empty($chs)) {
            $chs = new Chinese($charset, $target);
        } else {
            $chs->config['SourceLang'] = $chs->_lang($charset);
            $chs->config['TargetLang'] = $target;
        }
        echo $wapcharset == 1 ? $chs->Convert($content) : str_replace(array('&#x;', '&#x0;'), array('??', ''), $chs->Convert($content));
    } else {
        echo $content;
    }
}
Ejemplo n.º 30
0
function diconv($str, $in_charset, $out_charset = CHARSET, $ForceTable = FALSE)
{
    global $_G;
    $in_charset = strtoupper($in_charset);
    $out_charset = strtoupper($out_charset);
    if ($in_charset != $out_charset) {
        require_once libfile('class/chinese');
        $chinese = new Chinese($in_charset, $out_charset, $ForceTable);
        return $chinese->Convert($str);
    } else {
        return $str;
    }
}