Esempio n. 1
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;
 }
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);
}
Esempio n. 3
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, "'\\")) . '\');';
}
Esempio n. 4
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;
}
Esempio n. 5
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;
}
Esempio n. 6
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;
     }
 }
Esempio n. 7
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;
}
Esempio n. 8
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);
}
Esempio n. 9
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;
}
Esempio n. 10
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;
}
Esempio n. 11
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;
Esempio n. 12
0
$hu = 'eseach';
eval('$__file__=__FILE__;');
define('ROOT_PATH', $__file__ ? dirname($__file__) . '/' : './');
require_once "global.php";
$domain = $_POST['domain'] ? $_POST['domain'] : $_GET['domain'];
if ($domain) {
    is_domain($domain) or exit("<script language=javascript>alert('请输入正确的域名!');location.href='esearch.php';</script>");
    $url = 'http://' . trim($domain);
    $content = @file_get_contents($url);
    $charset = "/charset=(.*)/";
    preg_match($charset, $content, $charsetarr);
    $charset2 = strtolower(substr($charsetarr[1], 0, 2));
    if ($charset2 != 'gb') {
        require_once 'require/chinese.php';
        $chs = new Chinese('utf-8', 'GB2312');
        $content = $chs->Convert($content);
    }
    $pat1 = "/<title>(.*)<\\/title>/si";
    preg_match_all($pat1, $content, $array);
    $pat2 = "/meta content=\"(.+)\" name=\"keywords\"/Ui";
    $pat9 = "/meta name=\"keywords\" content=\"(.+)\"/Ui";
    preg_match_all($pat2, $content, $array2);
    preg_match_all($pat9, $content, $array9);
    $pat3 = "/<meta content=\"(.+)\" name=\"description\"/Usi";
    $pat8 = "/<meta name=\"description\" content=\"(.+)\"/Usi";
    preg_match_all($pat3, $content, $array3);
    preg_match_all($pat8, $content, $array8);
    $bods = "/<body>(.*)<\\/body>/is";
    preg_match_all($bods, $content, $array4);
    $pat4 = "/>(.*)</U";
    preg_match_all($pat4, $array4[0][0], $array5);
Esempio n. 13
0
<?php 
        showtype('video_config', 'top');
        showsetting('video_open', 'settingsnew[open]', $settings['open'], 'radio');
        showtype('video_basic');
        showsetting('video_site_name', 'settingsnew[bbname]', $settings['bbname'], 'text');
        showsetting('video_site_url', 'settingsnew[url]', $settings['url'], 'text');
        showsetting('video_site_email', 'settingsnew[email]', $settings['email'], 'text');
        showsetting('video_site_logo', 'settingsnew[logo]', $settings['logo'], 'text');
        showsetting('video_site_type', '', '', $sitetypeselect);
        showtype('', 'bottom');
        echo '<br /><center><input class="button" type="submit" name="configsubmit" value="' . $lang['submit'] . '"></form>';
    } else {
        if ($charset != 'utf-8') {
            require_once DISCUZ_ROOT . './include/chinese.class.php';
            $chs = new Chinese($charset, 'UTF-8');
            $settingsnew['bbnameu8'] = $chs->Convert($settingsnew['bbname']);
        } else {
            $settingsnew['bbnameu8'] = $settingsnew['bbname'];
        }
        $settingsnew['vtype'] = str_replace("\r\n", "\n", $settingsnew['vtype']);
        $settingsnew['vtype'] = str_replace("\n", "\t", $settingsnew['vtype']);
        if ($settingsnew['vtype']) {
            $sitetypexml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<channels>\n";
            foreach (explode("\t", $settingsnew['vtype']) as $key => $typename) {
                $sitetypexml .= $typename ? "\t<channel id='" . intval($key + 32) . "' name='" . ($charset != 'utf-8' ? $chs->Convert(htmlspecialchars($typename)) : $typename) . "' />\n" : '';
            }
            $sitetypexml .= "</channels>";
            if ($fp = @fopen(DISCUZ_ROOT . './forumdata/video_category.xml', 'wb')) {
                fwrite($fp, $sitetypexml);
                fclose($fp);
            }
Esempio n. 14
0
 function ttffont()
 {
     $seccode = $this->code;
     $charset = isset($GLOBALS['charset']) ? $GLOBALS['charset'] : '';
     $seccoderoot = $this->type ? $this->fontpath . 'ch/' : $this->fontpath . 'en/';
     $dirs = opendir($seccoderoot);
     $seccodettf = array();
     while ($entry = readdir($dirs)) {
         if ($entry != '.' && $entry != '..' && in_array(strtolower($this->fileext($entry)), array('ttf', 'ttc'))) {
             $seccodettf[] = $entry;
         }
     }
     if (empty($seccodettf)) {
         $this->giffont();
         return;
     }
     $seccodelength = 4;
     if ($this->type && !empty($seccodettf)) {
         if (strtoupper($charset) != 'UTF-8') {
             include $this->includepath . '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'] = $this->angle ? mt_rand(-30, 30) : 0;
         $font[$i]['size'] = $this->type ? $this->width / 7 : $this->width / 6;
         $this->size && ($font[$i]['size'] = mt_rand($font[$i]['size'] - $this->width / 40, $font[$i]['size'] + $this->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, $this->width / 8);
         $font[$i]['width'] = $font[$i]['width'] > $this->width / $seccodelength ? $this->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, $this->width - $widthtotal);
     !$this->color && ($text_color = imagecolorallocate($this->im, $this->fontcolor[0], $this->fontcolor[1], $this->fontcolor[2]));
     for ($i = 0; $i < $seccodelength; $i++) {
         if ($this->color) {
             $this->fontcolor = array(mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
             $this->shadow && ($text_shadowcolor = imagecolorallocate($this->im, 255 - $this->fontcolor[0], 255 - $this->fontcolor[1], 255 - $this->fontcolor[2]));
             $text_color = imagecolorallocate($this->im, $this->fontcolor[0], $this->fontcolor[1], $this->fontcolor[2]);
         } elseif ($this->shadow) {
             $text_shadowcolor = imagecolorallocate($this->im, 255 - $this->fontcolor[0], 255 - $this->fontcolor[1], 255 - $this->fontcolor[2]);
         }
         $y = $font[0]['angle'] > 0 ? mt_rand($font[$i]['height'], $this->height) : mt_rand($font[$i]['height'] - $font[$i]['hd'], $this->height - $font[$i]['hd']);
         $this->shadow && imagettftext($this->im, $font[$i]['size'], $font[$i]['angle'], $x + 1, $y + 1, $text_shadowcolor, $font[$i]['font'], $seccode[$i]);
         imagettftext($this->im, $font[$i]['size'], $font[$i]['angle'], $x, $y, $text_color, $font[$i]['font'], $seccode[$i]);
         $x += $font[$i]['width'];
     }
 }
Esempio n. 15
0
 /**
  * 进行编码转换,这里主要用于繁体转简体
  * @param $fcode 即from code ,原来的编码,比如"BIG5"
  * @param $tcode 即to code,目标编码,比如"GB2312"
  * @param $content 对已经处理过的文本进行转换
  * @param $dict_dir 转换字符对照表存放位置
  * @return $ret string 返回转换后的文本
  */
 function convertCode($content, $fcode = 'CHST', $tcode = 'CHSS', $dict_dir = null)
 {
     if (is_null($dict_dir)) {
         $dict_dir = $this->dict_dir;
     }
     L::loadClass('Chinese', 'utility/lang', false);
     $ch = new Chinese($fcode, $tcode, true);
     $ret = $ch->Convert($content);
     return $ret;
 }
Esempio n. 16
0
 function getHeader()
 {
     global $_G;
     $leftHtmlCode = '<div id="navs-wraper-v2" class="v2" onmouseover="document.getElementById(\'navs-menu\').style.display=\'block\'" onmouseout="document.getElementById(\'navs-menu\').style.display=\'none\'">';
     $leftHtmlCode .= '<p id="return-homepage"><a href="' . (!empty($_G['setting']['defaultindex']) ? $_G['setting']['defaultindex'] : 'forum.php') . '">' . lang('home/template', 'return_homepage') . '</a></p>' . "\n";
     $leftHtmlCode .= "<ul id=\"navs-menu\">\n";
     foreach ($_G['setting']['navs'] as $navsid => $nav) {
         $nav['nav'] = '<li ' . $nav['nav'] . '></li>';
         if ($nav['available']) {
             if ($navsid == 6 && !empty($_G['setting']['plugins']['jsmenu'])) {
                 $leftHtmlCode .= "\t{$nav['nav']}\n";
             } else {
                 if (!$nav['level'] || $nav['level'] == 1 && $_G['uid'] || $nav['level'] == 2 && $_G['adminid'] > 0 || $nav['level'] == 3 && $_G['adminid'] == 1) {
                     $leftHtmlCode .= "\t{$nav['nav']}\n";
                 }
             }
         }
     }
     $leftHtmlCode .= "</ul></div>\n";
     $rightHtmlCode = "<p>\n";
     if ($_G['uid']) {
         $rightHtmlCode .= "\t<strong><a href=\"home.php?mod=space\" class=\"noborder\" target=\"_blank\">{$_G[member][username]}</a></strong>\n";
         if ($_G['group']['allowinvisible']) {
             $rightHtmlCode .= "<span id=\"loginstatus\" class=\"xg1\"><a href=\"member.php?mod=switchstatus\" title=\"" . lang('template', 'login_switch_invisible_mode') . "\">";
             if ($_G['session']['invisible']) {
                 $rightHtmlCode .= lang('template', 'login_invisible_mode');
             } else {
                 $rightHtmlCode .= lang('template', 'login_normal_mode');
             }
             $rightHtmlCode .= "</a></span>\n";
         }
         $rightHtmlCode .= "\t<span class=\"pipe\">|</span><a href=\"home.php?mod=space&do=home\">" . lang('template', 'my_space') . "</a>\n";
         $rightHtmlCode .= "\t<span class=\"xg1\"><a href=\"home.php?mod=spacecp\">" . lang('template', 'setup') . "</a></span>\n";
         $rightHtmlCode .= "\t<span class=\"pipe\">|</span><a href=\"home.php?mod=space&do=notice\" id=\"myprompt\"" . ($_G['member']['newprompt'] ? ' class="new"' : '') . ">" . lang('template', 'notice') . ($_G['member']['newprompt'] ? '(' . $_G['member']['newprompt'] . ')' : '') . "</a><span id=\"myprompt_check\"></span>\n";
         $rightHtmlCode .= "\t<span class=\"pipe\">|</span><a href=\"home.php?mod=space&do=pm\" id=\"pm_ntc\"" . ($_G['member']['newpm'] ? ' class="new"' : '') . ">" . lang('template', 'pm_center') . ($_G['member']['newpm'] ? '(' . $_G['member']['newpm'] . ')' : '') . "</a>\n";
         if ($_G['group']['allowmanagearticle'] || $_G['group']['allowdiy']) {
             $rightHtmlCode .= "\t<span class=\"pipe\">|</span><a href=\"portal.php?mod=portalcp\" target=\"_blank\">" . lang('template', 'portal_manage') . "</a>\n";
         }
         if ($_G['uid'] && $_G['adminid'] > 1) {
             $rightHtmlCode .= "\t<span class=\"pipe\">|</span><a href=\"forum.php?mod=modcp&fid={$_G['fid']}\" target=\"_blank\">" . $_G['setting']['navs']['2']['navname'] . lang('template', 'manage') . "</a>\n";
         }
         if ($_G['uid'] && ($_G['adminid'] == 1 || $_G['member']['allowadmincp'])) {
             $rightHtmlCode .= "\t<span class=\"pipe\">|</span><a href=\"admin.php\" target=\"_blank\">" . lang('template', 'admincp') . "</a>\n";
         }
         $rightHtmlCode .= "\t<span class=\"pipe\">|</span><a href=\"member.php?mod=logging&action=logout&formhash=" . FORMHASH . "\">" . lang('template', 'logout') . "</a>\n";
     } elseif (!empty($_G['cookie']['loginuser'])) {
         $rightHtmlCode .= "\t<strong><a id=\"loginuser\" class=\noborder\">" . $_G['cookie']['loginuser'] . "</a></strong>\n";
         $rightHtmlCode .= "\t<span class=\"pipe\">|</span><a href=\"member.php?mod=logging&action=login\">" . lang('template', 'activation') . "</a>\n";
         $rightHtmlCode .= "\t<span class=\"pipe\">|</span><a href=\"member.php?mod=logging&action=logout&formhash={FORMHASH}\">" . lang('template', 'logout') . "</a>\n";
     } else {
         $rightHtmlCode .= "\t<a href=\"member.php?mod=" . $_G['setting']['regname'] . "\" class=\"noborder\">" . $_G['setting']['reglinkname'] . "</a>\n";
         $rightHtmlCode .= "\t<span class=\"pipe\">|</span><a href=\"member.php?mod=logging&action=login\">" . lang('template', 'login') . "</a>\n";
     }
     $rightHtmlCode .= "\t</p>\n";
     $siteurl = dirname(dirname($_G['siteurl']));
     $leftHtmlCode = urlcovert($leftHtmlCode, $siteurl);
     $rightHtmlCode = urlcovert($rightHtmlCode, $siteurl);
     if (strtolower($_G['config']['output']['charset']) != 'utf-8') {
         require_once libfile('class/chinese');
         $chinese = new Chinese($_G['config']['output']['charset'], 'utf-8', true);
         $leftHtmlCode = $chinese->Convert($leftHtmlCode);
         $rightHtmlCode = $chinese->Convert($rightHtmlCode);
     }
     $ret = array('left' => $leftHtmlCode, 'right' => $rightHtmlCode);
     return $ret;
 }
Esempio n. 17
0
 $filename = basename("{$attachdir}/" . $attach['attachurl']);
 $fileext = substr(strrchr($attach['attachurl'], '.'), 1);
 $filesize = 0;
 if (strpos($pwServer['HTTP_USER_AGENT'], 'MSIE') !== false && $fileext == 'torrent') {
     $attachment = 'inline';
 } else {
     $attachment = 'attachment';
 }
 $attach['name'] = trim(str_replace('&nbsp;', ' ', $attach['name']));
 if ($db_charset == 'utf-8') {
     if (function_exists('mb_convert_encoding')) {
         $attach['name'] = mb_convert_encoding($attach['name'], "gbk", 'utf-8');
     } else {
         L::loadClass('Chinese', 'utility/lang', false);
         $chs = new Chinese('UTF8', 'gbk');
         $attach['name'] = $chs->Convert($attach['name'], 'UTF8', 'gbk');
     }
 }
 $credit = $uploadcredit = $downloadmoney = null;
 if ($_G['allowdownload'] == 1) {
     $forumset = $foruminfo['forumset'];
     list($uploadcredit, , $downloadmoney, ) = explode("\t", $forumset['uploadset']);
     if ($downloadmoney) {
         require_once R_P . 'require/credit.php';
         if ($downloadmoney > 0 && $credit->get($winduid, $uploadcredit) < $downloadmoney) {
             $creditname = $credit->cType[$uploadcredit];
             wap_msg('download_money_limit', $basename);
         }
         $credit->addLog('topic_download', array($uploadcredit => -$downloadmoney), array('uid' => $winduid, 'username' => $windid, 'ip' => $onlineip, 'fname' => $foruminfo['name']));
         if (!$credit->set($winduid, $uploadcredit, -$downloadmoney, false)) {
             wap_msg('undefined_action', $basename);
Esempio n. 18
0
 function iconv($in_charset, $out_charset, $str)
 {
     require 'libs/iconv.php';
     $chinese = new Chinese();
     return $chinese->Convert($in_charset, $out_charset, $str);
 }
Esempio n. 19
0
} elseif ($operation == 'remove') {
    $addon = DB::fetch_first("SELECT * FROM " . DB::table('common_addon') . " WHERE `key`='{$_G['gp_provider']}'");
    if (!$addon) {
        cpmsg('addons_provider_nonexistence', '', 'error');
    }
    DB::query("DELETE FROM " . DB::table('common_addon') . " WHERE `key`='{$_G['gp_provider']}' AND system='0'");
    cpmsg('addons_provider_removesucceed', 'action=addons', 'succeed');
} elseif ($operation == 'add') {
    if (empty($_G['gp_providerkey'])) {
        $extra = !empty($_G['gp_category']) ? '&category=' . rawurlencode($_G['gp_category']) : '';
        $data = dfsockopen(ADDONS_SERVER . '/list.xml');
        require_once libfile('class/xml');
        if (strtoupper(CHARSET) != 'UTF-8') {
            require_once libfile('class/chinese');
            $c = new Chinese('utf8', CHARSET, TRUE);
            $data = $c->Convert($data);
        }
        $data = xml2array($data);
        shownav('addons');
        showsubmenu('addons', array(array('addons_list', 'addons', 0), array('addons_add', 'addons&operation=add', 1)));
        showtips('addons_add_tips');
        showtableheader();
        if (is_array($data) && $data) {
            $data = dstrip_tags($data);
            showsubtitle(array('addons_recommend', ''));
            echo '<tr><td>';
            foreach ($data as $row) {
                echo '<div class="hover" style="float:left;width:20%;height:100px;padding:5px 0"><div style="text-align:center"><a href="' . ADMINSCRIPT . '?action=addons&operation=add&providerkey=' . $row['key'] . '">' . ($row['logo'] ? '<img width="100" height="50" src="' . $row['logo'] . '" />' : '<img width="100" height="50" src="static/image/common/none.gif" />') . '</a><br /><a href="' . ADMINSCRIPT . '?action=addons&operation=add&providerkey=' . $row['key'] . '">' . $row['sitename'] . '</a></div></div>';
            }
            echo '</td></tr>';
        } else {
Esempio n. 20
0
require_once W_P . '/include/wap_mod.php';
include_once D_P . '/data/bbscache/forum_cache.php';
@header("content-type:text/html; charset=utf8");
$db_bbsurl = $_mainUrl;
$imgpath = $db_bbsurl . '/' . $imgpath;
$attachpath = $db_bbsurl . '/' . $attachpath;
$wapImages = './images';
$wap_perpage = 10;
if (!$db_wapifopen) {
    wap_msg('wap_closed');
}
if ($db_charset != 'utf8') {
    L::loadClass('Chinese', 'utility/lang', false);
    $chs = new Chinese('UTF8', $db_charset, true);
    foreach ($_POST as $key => $value) {
        $_POST[$key] = addslashes($chs->Convert(stripslashes($value)));
    }
}
$basename = substr($_SERVER['PHP_SELF'], strrpos($_SERVER['PHP_SELF'], '/') + 1);
$headTitle = $db_bbsname;
$isGM = CkInArray($windid, $manager);
if ($_GET['token']) {
    $token = deWindToken($_GET['token']);
    if ($token) {
        Cookie("winduser", $token);
        //自动获取勋章_start
        require_once R_P . 'require/functions.php';
        doMedalBehavior($winduid, 'continue_login');
        //自动获取勋章_end
        wap_msg("欢迎来到{$db_bbsname}", 'index.php');
    } else {
Esempio n. 21
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;
    }
}
Esempio n. 22
0
            $chs = new Chinese('utf-8', 'GB2312');
            $content[$i] = $chs->Convert($content[$i]);
        }
        if (preg_match($ROBOT[$jobs[$i]]['site_pattern'], $content2[$i], $matches2[$i])) {
            $site_info2[$i] = $matches2[$i][1];
        }
        $site_info2[$i] = $site_info2[$i] ? $site_info2[$i] : '--';
        $result .= '<td><a href="' . $ROBOT[$jobs[$i]]['site_url'] . $lurl . '" target="_blank">' . $site_info2[$i] . '</a></td>';
    }
    $result .= "</tr><tr><td>反向链接</td>";
    for ($j = 0; $j < sizeof($jobs); $j++) {
        $cnt = 0;
        while ($cnt < 10 && ($content[$j] = @file_get_contents($ROBOT[$jobs[$j]]['link_url'] . $lurl)) === FALSE) {
            $cnt++;
        }
        eval('$__file__=__FILE__;');
        define('ROOT_PATH', $__file__ ? dirname($__file__) . '/' : './');
        if ($j == 2 || $j == 4 || $j == 5) {
            require_once 'require/chinese.php';
            $chs = new Chinese('utf-8', 'GB2312');
            $content[$j] = $chs->Convert($content[$j]);
        }
        $site_info[$j] = $site_info[$j] ? $site_info[$j] : '--';
        if (preg_match($ROBOT[$jobs[$j]]['link_pattern'], $content[$j], $matches[$j])) {
            $site_info[$j] = $matches[$j][1];
        }
        $result .= '<td><a href="' . $ROBOT[$jobs[$j]]['link_url'] . $lurl . '" target="_blank">' . $site_info[$j] . '</a></td>';
    }
    $result .= "</tr></table>";
    echo $result;
}
Esempio n. 23
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";
     }
 }
Esempio n. 24
0
function wap_footer()
{
    global $wind_version, $db_obstart, $windid, $db_charset, $db_wapcharset, $chs, $timestamp, $db_online, $db, $db_wapregist, $rg_allowregister, $online_info, $db_bbsurl;
    Update_ol();
    $userinbbs = $guestinbbs = 0;
    if (empty($db_online)) {
        extract(pwCache::getData(D_P . 'data/bbscache/olcache.php', false));
    } else {
        if (count($online_info = explode("\t", GetCookie('online_info'))) == 3 && $timestamp - $online_info[0] < 60) {
            list(, $userinbbs, $guestinbbs) = $online_info;
        } else {
            $onlineService = L::loadClass('OnlineService', 'user');
            $userinbbs = $onlineService->countOnlineUser();
            $guestinbbs = $onlineService->countOnlineGuest();
            Cookie('online_info', $timestamp . "\t" . $userinbbs . "\t" . $guestinbbs);
        }
    }
    $usertotal = $guestinbbs + $userinbbs;
    $ft_time = get_date($timestamp);
    require_once PrintWAP('footer');
    $output = ob_get_contents();
    ob_end_clean();
    $db_obstart && function_exists('ob_gzhandler') ? ob_start('ob_gzhandler') : ob_start();
    if ($db_charset != 'utf8') {
        L::loadClass('Chinese', 'utility/lang', false);
        $chs = new Chinese();
        $output = $chs->Convert($output, $db_charset, $db_wapcharset ? 'UTF8' : 'UNICODE');
    }
    $output = str_replace(array('<!--<!---->', '<!---->-->', '<!---->', "\r\n\r\n"), '', $output);
    $wap_view = S::getGP('wap_view');
    if ($wap_view) {
        $output = preg_replace('/<a[^>]*>([^<]+|.*?)?<\\/a>/i', "\\1", $output);
    }
    echo $output;
    ob_flush();
    exit;
}
Esempio n. 25
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'];
    }
}
Esempio n. 26
0
        $name = array();
        $id = array();
        $T = '';
        $maxnum = 8;
        $xml_parser = xml_parser_create();
        xml_parse_into_struct($xml_parser, $data, $arr_vals);
        xml_parser_free($xml_parser);
        foreach ($arr_vals as $v) {
            if ($v['tag'] == 'ITEM' && $v['attributes']) {
                $name[] = $v['attributes']['NAME'];
            } elseif ($v['tag'] == 'CODE') {
                $id[] = $v['value'];
            }
        }
        if ($db_charset != 'utf-8') {
            L::loadClass('Chinese', 'utility/lang', false);
            $chs = new Chinese('UTF-8', $db_charset);
            foreach ($name as $k => $v) {
                $name[$k] = $chs->Convert($v);
            }
        }
        foreach ($id as $k => $v) {
            $T .= $T ? ",{$v} : '{$name[$k]}'" : "{$v} : '{$name[$k]}'";
            if (!$maxnum--) {
                break;
            }
        }
        pwCache::setData(D_P . "data/bbscache/myshow_default.php", "<?php\r\n\t\$mDef = \"{$T}\";\r\n?>");
    }
}
exit;
Esempio n. 27
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);
     }
 }
Esempio n. 28
0
 $filename = basename("{$attachdir}/" . $attach['attachurl']);
 $fileext = substr(strrchr($attach['attachurl'], '.'), 1);
 $filesize = 0;
 if (strpos($pwServer['HTTP_USER_AGENT'], 'MSIE') !== false && $fileext == 'torrent') {
     $attachment = 'inline';
 } else {
     $attachment = 'attachment';
 }
 $attach['name'] = trim(str_replace('&nbsp;', ' ', $attach['name']));
 if ($db_charset == 'utf-8') {
     if (function_exists('mb_convert_encoding')) {
         $attach['name'] = mb_convert_encoding($attach['name'], "gbk", 'utf-8');
     } else {
         L::loadClass('Chinese', 'utility/lang', false);
         $chs = new Chinese('UTF8', 'gbk');
         $attach['name'] = $chs->Convert($attach['name']);
     }
 }
 if ($db_attachhide && $attach['size'] > $db_attachhide && $attach['type'] == 'zip' && !defined('FX')) {
     ObHeader($fgeturl[0]);
 } elseif ($fgeturl[1] == 'Local') {
     $fgeturl[0] = R_P . $fgeturl[0];
     $filesize = filesize($fgeturl[0]);
 }
 $ctype = '';
 switch ($fileext) {
     case "pdf":
         $ctype = "application/pdf";
         break;
     case "rar":
     case "zip":
Esempio 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;
    }
}
Esempio n. 30
0
         $fontpath = $settingnew['watermarktext']['fontpath'];
         $fontpathnew = 'ch/' . $fontpath;
         $settingnew['watermarktext']['fontpath'] = file_exists('static/image/seccode/font/' . $fontpathnew) ? $fontpathnew : '';
         if (!$settingnew['watermarktext']['fontpath']) {
             $fontpathnew = 'en/' . $fontpath;
             $settingnew['watermarktext']['fontpath'] = file_exists('static/image/seccode/font/' . $fontpathnew) ? $fontpathnew : '';
         }
         if (!$settingnew['watermarktext']['fontpath']) {
             cpmsg('watermarkpreview_fontpath_error', '', 'error');
         }
         $settingnew['watermarktext']['fontpath'] = 'static/image/seccode/font/' . $settingnew['watermarktext']['fontpath'];
     }
     if ($settingnew['watermarktext']['text'] && strtoupper(CHARSET) != 'UTF-8') {
         include libfile('class/chinese');
         $c = new Chinese(CHARSET, 'utf8');
         $settingnew['watermarktext']['text'] = $c->Convert($settingnew['watermarktext']['text']);
     }
     $settingnew['watermarktext']['text'] = bin2hex($settingnew['watermarktext']['text']);
     $_G['setting']['watermarktext'] = $settingnew['watermarktext'];
 }
 require_once libfile('class/image');
 @unlink(DISCUZ_ROOT . './data/attachment/temp/watermark_temp3.jpg');
 $image = new image();
 if (!($r = $image->Watermark(DISCUZ_ROOT . './static/image/admincp/watermarkpreview.jpg', 'temp/watermark_temp3.jpg'))) {
     $r = $image->error();
 }
 if ($r > 0) {
     showsubmenu('imagepreview_watermark');
     $sizesource = filesize('static/image/admincp/watermarkpreview.jpg');
     $sizetarget = $image->imginfo['size'];
     echo '<img src="data/attachment/temp/watermark_temp3.jpg?' . random(5) . '"><br /><br />' . $lang['imagepreview_imagesize_source'] . ' ' . number_format($sizesource) . ' Bytes &nbsp;&nbsp;' . $lang['imagepreview_imagesize_target'] . ' ' . number_format($sizetarget) . ' Bytes (' . sprintf("%2.1f", $sizetarget / $sizesource * 100) . '%)';