コード例 #1
0
 function AppCode(&$str)
 {
     if ($this->moduleLang == $this->sysLang) {
         return $str;
     } else {
         if ($this->sysLang == 'utf-8') {
             if ($this->moduleLang == 'gbk') {
                 return gb2utf8($str);
             }
             if ($this->moduleLang == 'big5') {
                 return gb2utf8(big52gb($str));
             }
         } else {
             if ($this->sysLang == 'gbk') {
                 if ($this->moduleLang == 'utf-8') {
                     return utf82gb($str);
                 }
                 if ($this->moduleLang == 'big5') {
                     return big52gb($str);
                 }
             } else {
                 if ($this->sysLang == 'big5') {
                     if ($this->moduleLang == 'utf-8') {
                         return gb2big5(utf82gb($str));
                     }
                     if ($this->moduleLang == 'gbk') {
                         return gb2big5($str);
                     }
                 } else {
                     return $str;
                 }
             }
         }
     }
 }
コード例 #2
0
 function SetSource($str)
 {
 	global $cfg_ver_lang;
 	if($cfg_ver_lang=='utf-8') $str = utf82gb($str);
 	$this->SourceString = trim($this->ReviseString($str));
 	$this->ResultString = '';
 }
コード例 #3
0
ファイル: inc_coonepage.php プロジェクト: hensonvip/ymroad
/**
 *  获取一个页面
 *
 * @access    public
 * @param     string  $gurl  操作地址
 * @return    string
 */
function CoOnePage($gurl)
{
    global $dsql, $cfg_auot_description, $cfg_soft_lang;
    $redatas = array('title' => '', 'body' => '', 'source' => '', 'writer' => '', 'description' => '', 'keywords' => '');
    $redatas['source'] = preg_replace("/http:\\/\\//i", "", $gurl);
    $redatas['source'] = preg_replace("/\\/(.*)\$/i", "", $redatas['source']);
    $row = $dsql->GetOne("SELECT * FROM `#@__co_onepage` WHERE url LIKE '" . $redatas['source'] . "' ");
    $s = $e = '';
    if (is_array($row)) {
        list($s, $e) = explode('{@body}', $row['rule']);
        $s = trim($s);
        $e = trim($e);
        if ($row['issource'] == 1) {
            $redatas['source'] = $row['title'];
        }
    }
    $htd = new DedeHttpDown();
    $htd->OpenUrl($gurl);
    $body = $htd->GetHtml();
    if ($body != '') {
        //编码自动转换
        if ($cfg_soft_lang == 'utf-8') {
            if ($row['lang'] == 'gb2312') {
                $body = gb2utf8($body);
            }
        } else {
            if ($cfg_soft_lang == 'gb2312') {
                if ($row['lang'] == 'utf-8') {
                    $body = utf82gb($body);
                }
            }
        }
        //获取标题
        $inarr = array();
        preg_match("/<title>(.*)<\\/title>/isU", $body, $inarr);
        if (isset($inarr[1])) {
            $redatas['title'] = $inarr[1];
        }
        //获取关键词
        $inarr = array();
        preg_match("/<meta[\\s]+name=['\"]keywords['\"] content=['\"](.*)['\"]/isU", $body, $inarr);
        if (isset($inarr[1])) {
            $redatas['keywords'] = cn_substr(html2text($inarr[1]), 30);
        }
        //获取摘要
        $inarr = array();
        preg_match("/<meta[\\s]+name=['\"]description['\"] content=['\"](.*)['\"]/isU", $body, $inarr);
        if (isset($inarr[1])) {
            $redatas['description'] = cn_substr(html2text($inarr[1]), $cfg_auot_description);
        }
        //获取内容
        if ($s != '' && $e != '') {
            $redatas['body'] = GetHtmlAreaA($s, $e, $body);
            if ($redatas['body'] != '' && $redatas['description'] == '') {
                $redatas['description'] = cn_substr(html2text($redatas['body']), $GLOBALS['cfg_auot_description']);
            }
        }
    }
    return $redatas;
}
コード例 #4
0
/**
 *  检查用户名的合法性
 *
 * @access    public
 * @param     string  $uid  用户UID
 * @param     string  $msgtitle  提示标题
 * @param     string  $ckhas  检查是否存在
 * @return    string
 */
function CheckUserID($uid, $msgtitle='用户名', $ckhas=TRUE)
{
    global $cfg_mb_notallow,$cfg_mb_idmin,$cfg_md_idurl,$cfg_soft_lang,$dsql;
    if($cfg_mb_notallow != '')
    {
        $nas = explode(',', $cfg_mb_notallow);
        if(in_array($uid, $nas))
        {
            return $msgtitle.'为系统禁止的标识!';
        }
    }
    if($cfg_md_idurl=='Y' && preg_match("/[^a-z0-9]/i",$uid))
    {
        return $msgtitle.'必须由英文字母或数字组成!';
    }

    if($cfg_soft_lang=='utf-8')
    {
        $ck_uid = utf82gb($uid);
    }
    else
    {
        $ck_uid = $uid;
    }

    for($i=0; isset($ck_uid[$i]); $i++)
    {
        if(ord($ck_uid[$i]) > 0x80)
        {
            if(isset($ck_uid[$i+1]) && ord($ck_uid[$i+1])>0x40)
            {
                $i++;
            }
            else
            {
                return $msgtitle.'可能含有乱码,建议你改用英文字母和数字组合!';
            }
        }
        else
        {
            if(preg_match("/[^0-9a-z@\.-]/i",$ck_uid[$i]))
            {
                return $msgtitle.'不能含有 [@]、[.]、[-]以外的特殊符号!';
            }
        }
    }
    if($ckhas)
    {
        $row = $dsql->GetOne("SELECT * FROM `#@__member` WHERE userid LIKE '$uid' ");
        if(is_array($row)) return $msgtitle."已经存在!";
    }
    return 'ok';
}
コード例 #5
0
ファイル: slide.php プロジェクト: healthguo/PHP
 function ac_index()
 {
     global $cfg_soft_lang;
     if (file_exists(DEDEASK . "/data/cache/slide.inc")) {
         require_once DEDEASK . "/data/cache/slide.inc";
         if ($cfg_soft_lang == 'utf-8') {
             $row = AutoCharset(unserialize(utf82gb($data)));
         } else {
             $row = unserialize($data);
         }
     }
     //设定变量值
     $GLOBALS['row'] = $row;
     //载入模板
     $this->SetTemplate('slide.htm');
     $this->Display();
 }
コード例 #6
0
ファイル: index.php プロジェクト: healthguo/PHP
 function ac_index()
 {
     global $cfg_soft_lang;
     $row = 8;
     //推荐问题
     $digests = $this->question->get_digests(7);
     //待解决的问题
     $notoks = $this->question->get_all('status=0', 'ORDER BY disorder DESC, dateline DESC', $row);
     //新解决的问题
     $solutions = $this->question->get_all('status=1', 'ORDER BY solvetime DESC', $row);
     //高分悬赏问题
     $rewards = $this->question->get_all('status=0', 'ORDER BY reward DESC', $row);
     //获取问题数
     $solvenum = $this->question->get_total();
     //首页幻灯片
     if (file_exists(DEDEASK . "/data/cache/slide.inc")) {
         require_once DEDEASK . "/data/cache/slide.inc";
         if ($cfg_soft_lang == 'utf-8') {
             $row = AutoCharset(unserialize(utf82gb($data)));
         } else {
             $row = unserialize($data);
         }
     }
     //处理链接地址
     if ($GLOBALS['cfg_ask_rewrite'] == 'Y') {
         $digests = makerewurl($digests, 'id');
         $notoks = makerewurl($notoks, 'id');
         $solutions = makerewurl($solutions, 'id');
         $rewards = makerewurl($rewards, 'id');
     } else {
         $digests = makeurl($digests, 'id');
         $notoks = makeurl($notoks, 'id');
         $solutions = makeurl($solutions, 'id');
         $rewards = makeurl($rewards, 'id');
     }
     //设定变量值
     $GLOBALS['row'] = $row;
     $GLOBALS['digests'] = $digests;
     $GLOBALS['notoks'] = $notoks;
     $GLOBALS['rewards'] = $rewards;
     $GLOBALS['solutions'] = $solutions;
     $GLOBALS['solvenum'] = $solvenum;
     //载入模板
     $this->SetTemplate('index.htm');
     $this->Display();
 }
コード例 #7
0
function CheckUserID($uid, $msgtitle = '用户名', $ckhas = true)
{
    global $cfg_mb_notallow, $cfg_mb_idmin, $cfg_md_idurl, $cfg_soft_lang, $dsql;
    if ($cfg_mb_notallow != '') {
        $nas = explode(',', $cfg_mb_notallow);
        if (in_array($uid, $nas)) {
            return $msgtitle . '为系统禁止的标识!';
        }
    }
    if ($cfg_md_idurl == 'Y' && eregi("[^a-z0-9]", $uid)) {
        return $msgtitle . '必须由英文字母或数字组成!';
    }
    if ($cfg_soft_lang == 'utf-8') {
        $ck_uid = utf82gb($uid);
    } else {
        $ck_uid = $uid;
    }
    for ($i = 0; isset($ck_uid[$i]); $i++) {
        if (ord($ck_uid[$i]) > 0x80) {
            if (isset($ck_uid[$i + 1]) && ord($ck_uid[$i + 1]) > 0x40) {
                $i++;
            } else {
                return $msgtitle . '可能含有乱码,建议你改用英文字母和数字组合!';
            }
        } else {
            if (eregi("[^0-9a-z@\\.-]", $ck_uid[$i])) {
                return $msgtitle . '不能含有 [@]、[.]、[-]以外的特殊符号!';
            }
        }
    }
    if ($ckhas) {
        $row = $dsql->GetOne("Select * From `#@__member` where userid like '{$uid}' ");
        if (is_array($row)) {
            return $msgtitle . "已经存在!";
        }
    }
    return 'ok';
}
コード例 #8
0
ファイル: archives_do.php プロジェクト: klr2003/sourceread
 $query = "Select arc.*, addt.* From `#@__archives` arc left join `#@__addonarticle` addt on addt.aid=arc.id  where arc.id in({$arcids}) And arc.channel=1 ";
 $dsql->SetQuery($query);
 $dsql->Execute();
 while ($row = $dsql->GetArray()) {
     //跳过已经有关键字的内容
     if (trim($row['keywords']) != '') {
         continue;
     }
     $aid = $row['id'];
     $keywords = '';
     $title = $row['title'];
     $description = $row['description'];
     $body = cn_substr($row['body'], 5000);
     if ($cfg_soft_lang == 'utf-8') {
         $title = utf82gb($title);
         $body = utf82gb($body);
     }
     $titleindexs = explode(' ', preg_replace("/#p#|#e#/", '', $sp->GetIndexText($title)));
     $allindexs = explode(' ', preg_replace("/#p#|#e#/", '', $sp->GetIndexText(Html2Text($body), 500)));
     if (is_array($allindexs) && is_array($titleindexs)) {
         foreach ($titleindexs as $k) {
             if (strlen($keywords . $k) >= 30) {
                 break;
             } else {
                 $keywords .= $k . ',';
             }
         }
         foreach ($allindexs as $k) {
             if (strlen($keywords . $k) >= 30) {
                 break;
             } else {
コード例 #9
0
 /**
  *  编码转换
  *
  * @access    public
  * @param     string  $str  字符串
  * @return    string
  */
 function ChangeCode(&$str)
 {
     global $cfg_soft_lang;
     if ($cfg_soft_lang == 'utf-8') {
         if ($this->noteInfos["sourcelang"] == "gb2312") {
             $str = gb2utf8($str);
         }
         if ($this->noteInfos["sourcelang"] == "big5") {
             $str = gb2utf8(big52gb($str));
         }
     } else {
         if ($this->noteInfos["sourcelang"] == "utf-8") {
             $str = utf82gb($str);
         }
         if ($this->noteInfos["sourcelang"] == "big5") {
             $str = big52gb($str);
         }
     }
 }
コード例 #10
0
ファイル: dedecollection.func.php プロジェクト: stonelf/mcgmh
/**
 *  分析RSS里的链接
 *
 * @access    public
 * @param     string  $rssurl  rss地址
 * @return    string
 */
function GetRssLinks($rssurl)
{
    global $cfg_soft_lang;
    $dhd = new DedeHttpDown();
    $dhd->OpenUrl($rssurl);
    $rsshtml = $dhd->GetHtml();
    //分析编码
    preg_match("/encoding=[\"']([^\"']*)[\"']/is", $rsshtml, $infos);
    if (isset($infos[1])) {
        $pcode = strtolower(trim($infos[1]));
    } else {
        $pcode = strtolower($cfg_soft_lang);
    }
    if ($cfg_soft_lang == 'gb2312') {
        if ($pcode == 'utf-8') {
            $rsshtml = utf82gb($rsshtml);
        } else {
            if ($pcode == 'big5') {
                $rsshtml = big52gb($rsshtml);
            }
        }
    } else {
        if ($cfg_soft_lang == 'utf-8') {
            if ($pcode == 'gbk' || $pcode == 'gb2312') {
                $rsshtml = gb2utf8($rsshtml);
            } else {
                if ($pcode == 'big5') {
                    $rsshtml = gb2utf8(big52gb($rsshtml));
                }
            }
        }
    }
    $rsarr = array();
    preg_match_all("/<item(.*)<title>(.*)<\\/title>/isU", $rsshtml, $titles);
    preg_match_all("/<item(.*)<link>(.*)<\\/link>/isU", $rsshtml, $links);
    preg_match_all("/<item(.*)<description>(.*)<\\/description>/isU", $rsshtml, $descriptions);
    if (!isset($links[2])) {
        return '';
    }
    foreach ($links[2] as $k => $v) {
        $rsarr[$k]['link'] = RpCdata($v);
        if (isset($titles[2][$k])) {
            $rsarr[$k]['title'] = RpCdata($titles[2][$k]);
        } else {
            $rsarr[$k]['title'] = preg_replace("/^(.*)\\//i", "", RpCdata($titles[2][$k]));
        }
        if (isset($descriptions[2][$k])) {
            $rsarr[$k]['image'] = GetddImgFromRss($descriptions[2][$k], $rssurl);
        } else {
            $rsarr[$k]['image'] = '';
        }
    }
    return $rsarr;
}
コード例 #11
0
ファイル: p_list.php プロジェクト: qinlibingfeng/CallCenter
                 $result = "不存在";
                 $bcz_count += 1;
             }
         } else {
             $wav_name .= ".wav";
             $result = "无录音";
             $wly_count += 1;
         }
         //$result_sql.="('".$wav_name."','".$result."','','".$job_id."'),";
         $copy_log = $phone_number . "\t" . $cam_dir2 . "/" . $wav_name . "\t" . utf82gb($result) . "\r\n";
         fwrite($fp, $copy_log);
     }
     $false_count = $sb_count + $bcz_count + $wly_count;
     //echo $up_job_sql;
     $copy_logs = "\r\n\r\n共:" . $sum_count . "个,成功:" . $true_count . "个,失败:" . $false_count . "个(处理失败:" . $sb_count . ",文件不存在:" . $bcz_count . ",无录音:" . $wly_count . ")";
     fwrite($fp, utf82gb($copy_logs));
     //fclose($fp);
     $wav_file_list = "";
     $counts = "1";
     $des = "拷贝完成,即将开始压缩处理,请稍后...";
     $result = "共:<span class=\"red\">" . $sum_count . "</span>个,成功:<span class=\"red\">" . $true_count . "</span>个,失败:<span class=\"red\">" . $false_count . "</span> 个(处理失败:<span class=\"red\">" . $sb_count . "</span>,文件不存在:<span class=\"red\">" . $bcz_count . "</span>,无录音:<span class=\"red\">" . $wly_count . "</span>)";
 } else {
     $counts = "0";
     $des = "未找到符合条件的数据!";
     fwrite($fp, $des);
 }
 fclose($fp);
 mysqli_free_result($rows);
 $json_data = "{";
 $json_data .= "\"counts\":" . json_encode($counts) . ",";
 $json_data .= "\"des\":" . json_encode($des) . ",";
コード例 #12
0
ファイル: config_pay_tenpay.php プロジェクト: iabing/mzzyc
  如果sp_billno不足10位, 则左补0, 加到transaction_id后部*/
$strTransactionId = $strSpid . $strBillDate . time();
/*货币类型: 1 – RMB(人民币) 2 - USD(美元) 3 - HKD(港币)*/
$strFeeType = "1";
/*财付通回调页面地址, 推荐使用ip地址的方式(最长255个字符)*/
$strRetUrl = $cfg_basehost . "/member/paycenter/tenpay/notify_handler.php";
/*商户私有数据, 请求回调页面时原样返回*/
$strAttach = "my_magic_string";
/*生成MD5签名*/
$strSignText = "cmdno=" . $strCmdNo . "&date=" . $strBillDate . "&bargainor_id=" . $strSaler . "&transaction_id=" . $strTransactionId . "&sp_billno=" . $strSpBillNo . "&total_fee=" . $strTotalFee . "&fee_type=" . $strFeeType . "&return_url=" . $strRetUrl . "&attach=" . $strAttach . "&key=" . $strSpkey;
$strSign = strtoupper(md5($strSignText));
/*请求支付串*/
$strRequest = "cmdno=" . $strCmdNo . "&date=" . $strBillDate . "&bargainor_id=" . $strSaler . "&transaction_id=" . $strTransactionId . "&sp_billno=" . $strSpBillNo . "&total_fee=" . $strTotalFee . "&fee_type=" . $strFeeType . "&return_url=" . $strRetUrl . "&attach=" . $strAttach . "&bank_type=" . $strBankType . "&desc=" . $strDesc . "&purchaser_id=" . $strBuyerId . "&sign=" . $strSign;
$strRequestUrl = "https://www.tenpay.com/cgi-bin/v1.0/pay_gate.cgi?" . $strRequest;
if ($cfg_soft_lang == 'utf-8') {
    $strRequestUrl = utf82gb($strRequestUrl);
    echo '<html>
    <head>
        <title>转到财付通支付页面</title>
    </head>
    <body onload="document.tenpay.submit();">
        <form name="tenpay" action="paycenter/tenpay/tenpay_gbk_page.php?strReUrl=' . urlencode($strRequestUrl) . '" method="post">
        </form>
    </body>
    </html>';
} else {
    echo '<html>
    <head>
        <title>转到财付通支付页面</title>
    </head>
    <body onload="document.tenpay.submit();">
コード例 #13
0
	function ChangeCode(&$str)
	{
		if($GLOBALS['cfg_ver_lang']=='utf-8'){
		  if($this->Item["language"]=="gb2312") $str = gb2utf8($str);
		  if($this->Item["language"]=="big5") $str = gb2utf8(big52gb($str));
		}else{
			if($this->Item["language"]=="utf-8") $str = utf82gb($str);
		  if($this->Item["language"]=="big5") $str = big52gb($str);
		}
	}
コード例 #14
0
function cn_substr($str, $slen, $startdd = 0)
{
    if ($charset == 'utf-8') {
        $str = utf82gb($str);
        return gb2utf8(cn_substrGb($str, $slen, $startdd));
    } else {
        return cn_substrGb($str, $slen, $startdd);
    }
}
コード例 #15
0
 function RemoveXss($val)
 {
     global $cfg_soft_lang;
     if ($cfg_soft_lang == 'gb2312') {
         gb2utf8($val);
     }
     $val = preg_replace('/([\\x00-\\x08,\\x0b-\\x0c,\\x0e-\\x19])/', '', $val);
     $search = 'abcdefghijklmnopqrstuvwxyz';
     $search .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
     $search .= '1234567890!@#$%^&*()';
     $search .= '~`";:?+/={}[]-_|\'\\';
     for ($i = 0; $i < strlen($search); $i++) {
         $val = preg_replace('/(&#[xX]0{0,8}' . dechex(ord($search[$i])) . ';?)/i', $search[$i], $val);
         // with a ;
         $val = preg_replace('/(&#0{0,8}' . ord($search[$i]) . ';?)/', $search[$i], $val);
         // with a ;
     }
     $val = str_replace("`", "‘", $val);
     $val = str_replace("'", "‘", $val);
     $val = str_replace("\"", "“", $val);
     $val = str_replace(",", ",", $val);
     $val = str_replace("(", "(", $val);
     $val = str_replace(")", ")", $val);
     $ra1 = array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'style', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base');
     $ra2 = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload');
     $ra = array_merge($ra1, $ra2);
     $found = true;
     while ($found == true) {
         $val_before = $val;
         for ($i = 0; $i < sizeof($ra); $i++) {
             $pattern = '/';
             for ($j = 0; $j < strlen($ra[$i]); $j++) {
                 if ($j > 0) {
                     $pattern .= '(';
                     $pattern .= '(&#[xX]0{0,8}([9ab]);)';
                     $pattern .= '|';
                     $pattern .= '|(&#0{0,8}([9|10|13]);)';
                     $pattern .= ')*';
                 }
                 $pattern .= $ra[$i][$j];
             }
             $pattern .= '/i';
             $replacement = substr($ra[$i], 0, 2) . '<x>' . substr($ra[$i], 2);
             $val = preg_replace($pattern, $replacement, $val);
             if ($val_before == $val) {
                 $found = false;
             }
         }
     }
     if ($cfg_soft_lang == 'gb2312') {
         utf82gb($val);
     }
     return $val;
 }
コード例 #16
0
function dd2char($dd){
	if($GLOBALS['cfg_ver_lang']=='utf-8') $dd = utf82gb($dd);
	$slen = strlen($dd);
	$okdd = "";
	for($i=0;$i<$slen;$i++){
		if(isset($dd[$i+1]))
		{
			$n = $dd[$i].$dd[$i+1];
			if(($n>96 && $n<123)||($n>64 && $n<91)){
				$okdd .= chr($n); $i++;
			}
			else $okdd .= $dd[$i];
		}else $okdd .= $dd[$i];
	}
	return $okdd;
}
コード例 #17
0
ファイル: pub_func.php プロジェクト: qinlibingfeng/CallCenter
function save_detail_excel($sql, $file_name, $file_type = "xls")
{
    global $db_conn;
    if ($sql != "") {
        set_time_limit(0);
        ini_set('memory_limit', '600M');
        $rows = mysqli_query($db_conn, $sql);
        $row_counts_list = mysqli_num_rows($rows);
        $field_count = mysqli_num_fields($rows);
        $fields = mysqli_fetch_fields($rows);
        if ($row_counts_list != 0) {
            //文档类型
            if ($file_type == "xls") {
                //记录集个数小于2000,使用phpexcel生成xls
                /*if ($row_counts_list<2000 and $field_count<12) {
                  include("../plugin/excel.php");
                  //当前活动表
                  $objPHPExcel->setActiveSheetIndex(0);
                  //sheet表名
                  $objPHPExcel->getActiveSheet()->setTitle("".$file_name."");
                  $field_count2=$field_count-1;
                  $objPHPExcel->getActiveSheet()->setSharedStyle($excel_tit_left, "A1:$tit_arr[$field_count2]1");	
                  $objPHPExcel->getActiveSheet()->setSharedStyle($excel_list_left, "A2:$tit_arr[$field_count2]".($row_counts_list+1));
                  for ($i=0;$i<$field_count;$i++){
                  $objPHPExcel->getActiveSheet()->setCellValue("$tit_arr[$i]1","".$fields[$i]->name."");
                  }
                  $i=1;
                  while($rs= mysqli_fetch_array($rows)){ 
                  $i+=1;
                  for ($k=0;$k<$field_count;$k++){
                  
                  $objPHPExcel->getActiveSheet()->getCell($tit_arr[$k].$i)->setValueExplicit($rs[$k], PHPExcel_Cell_DataType::TYPE_STRING);
                  
                  }
                  //if($i%100==0){
                  //	ob_flush();
                  //	flush();
                  //}
                  }
                  $objPHPExcel->setActiveSheetIndex(0);
                  
                  $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
                  $file_path=excel_file("".$file_name."_","xls");
                  $objWriter->save(str_replace('.php', '.xls',$file_path[2]));
                  
                  }else{*/
                //记录集个数大于2000,使用XML生成xls
                include "Spreadsheet/Excel/Writer.php";
                $file_path = excel_file("" . $file_name . "_", "xls");
                $workbook = new Spreadsheet_Excel_Writer($file_path[2]);
                $workbook->setCustomColor(20, 146, 208, 80);
                $format_title_sty =& $workbook->addformat(array('Size' => 10, 'Bold' => 1, 'Border' => 1, 'FgColor' => 20, 'FontFamily' => utf82gb("宋体")));
                $format_cont_sty =& $workbook->addformat(array('Size' => 10, 'Border' => 1, 'FontFamily' => utf82gb("宋体")));
                $sheet_rows = 40000;
                //单Sheet记录集个数
                $sheet_id = 0;
                $i = 0;
                $sheet_i = 0;
                while ($rs = mysqli_fetch_array($rows)) {
                    $i++;
                    $sheet_i++;
                    $row_ = $i % $sheet_rows;
                    if ($row_ == 1) {
                        if ($row_counts_list < $sheet_rows + 1) {
                            $sheet_id = "";
                        } else {
                            $sheet_id++;
                        }
                        $sheets =& $workbook->addWorksheet("" . utf82gb($file_name . $sheet_id) . "");
                        for ($f = 0; $f < $field_count; $f++) {
                            $sheets->writeString(0, $f, utf82gb($fields[$f]->name), $format_title_sty);
                        }
                        $sheet_i = 1;
                    }
                    for ($k = 0; $k < $field_count; $k++) {
                        $sheets->writeString($sheet_i, $k, utf82gb($rs[$k]), $format_cont_sty);
                    }
                }
                $workbook->close();
                //}
            } elseif ($file_type == "xml_xls") {
                $file_type = "xls";
                $file_path = excel_file("" . $file_name . "_", $file_type);
                $fp = fopen($file_path[2], "w");
                $sheet_rows = 40000;
                //单Sheet记录集个数
                $xml_head = "<?xml version=\"1.0\"?>\n<?mso-application progid=\"Excel.Sheet\"?>\n<Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\" xmlns:html=\"http://www.w3.org/TR/REC-html40\"><DocumentProperties xmlns=\"urn:schemas-microsoft-com:office:office\"><Title>详单数据导出</Title><Author>亚铭科技</Author><Category>详单、汇总</Category>\n<Company>亚铭科技</Company></DocumentProperties>\n<OfficeDocumentSettings xmlns=\"urn:schemas-microsoft-com:office:office\"><AllowPNG/> <RemovePersonalInformation/></OfficeDocumentSettings><ExcelWorkbook xmlns=\"urn:schemas-microsoft-com:office:excel\"> <WindowHeight>8010</WindowHeight><WindowWidth>14805</WindowWidth><WindowTopX>240</WindowTopX><WindowTopY>105</WindowTopY>\n<ProtectStructure>False</ProtectStructure><ProtectWindows>False</ProtectWindows></ExcelWorkbook>\n<Styles>\n<Style ss:ID=\"Default\" ss:Name=\"Normal\"><Alignment ss:Vertical=\"Bottom\"/><Borders/><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"10\" ss:Color=\"#000000\"/><Interior/><NumberFormat/><Protection/></Style><Style ss:ID=\"s71\"><Alignment ss:Vertical=\"Center\"/><Borders><Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/><Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/><Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/><Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/></Borders><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Color=\"#000000\"/><NumberFormat ss:Format=\"@\"/></Style><Style ss:ID=\"s72\"><Alignment ss:Vertical=\"Center\"/><Borders>\n<Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/><Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n <Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/><Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/></Borders><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Color=\"#000000\" ss:Bold=\"1\"/> <Interior ss:Color=\"#92D050\" ss:Pattern=\"Solid\"/><NumberFormat ss:Format=\"@\"/></Style></Styles>";
                fwrite($fp, $xml_head);
                for ($i = 0; $i < $field_count; $i++) {
                    $filed_list .= "<Cell ss:StyleID=\"s72\"><Data ss:Type=\"String\">" . $fields[$i]->name . "</Data></Cell>";
                }
                $xml_sheet_head_row = "<Row>" . ($filed_list .= "</Row>");
                $i = 0;
                $sheet_id = 0;
                while ($rs = mysqli_fetch_array($rows)) {
                    $i++;
                    $style = "";
                    $f_list = "";
                    $row_ = $i % $sheet_rows;
                    if ($row_ == 1) {
                        if ($row_counts_list < $sheet_rows + 1) {
                            $sheet_id = "";
                        } else {
                            $sheet_id++;
                        }
                        fwrite($fp, "\n<Worksheet ss:Name=\"" . $file_name . $sheet_id . "\">\n<Table x:FullRows=\"1\"  ss:DefaultRowHeight=\"15\">" . $xml_sheet_head_row);
                        ob_flush();
                        flush();
                    }
                    for ($k = 0; $k < $field_count; $k++) {
                        $f_list .= "<Cell ss:StyleID=\"s71\"><Data ss:Type=\"String\">" . $rs[$k] . "</Data></Cell>";
                    }
                    fwrite($fp, "<Row>" . $f_list . "</Row>");
                    if ($row_ == 0) {
                        fwrite($fp, "</Table>\n<WorksheetOptions xmlns=\"urn:schemas-microsoft-com:office:excel\"><Unsynced/><Print><ValidPrinterInfo/>\n<PaperSizeIndex>9</PaperSizeIndex>\n<HorizontalResolution>-3</HorizontalResolution><VerticalResolution>0</VerticalResolution></Print><Selected/><Panes><Pane><Number>3</Number><ActiveCol>1</ActiveCol></Pane></Panes><ProtectObjects>False</ProtectObjects><ProtectScenarios>False</ProtectScenarios></WorksheetOptions></Worksheet>\n\n");
                    }
                }
                if ($row_ < $sheet_rows) {
                    fwrite($fp, "</Table>\n<WorksheetOptions xmlns=\"urn:schemas-microsoft-com:office:excel\"><Unsynced/><Print><ValidPrinterInfo/>\n<PaperSizeIndex>9</PaperSizeIndex>\n<HorizontalResolution>-3</HorizontalResolution><VerticalResolution>0</VerticalResolution></Print><Selected/><Panes><Pane><Number>3</Number><ActiveCol>1</ActiveCol></Pane></Panes><ProtectObjects>False</ProtectObjects><ProtectScenarios>False</ProtectScenarios></WorksheetOptions></Worksheet>\n\n");
                }
                fwrite($fp, "</Workbook>");
                fclose($fp);
                unset($xml_head);
                unset($filed_list);
                unset($f_list);
            } elseif ($file_type == "csv") {
                //生成Csv文档
                $file_path = excel_file("" . $file_name . "_", $file_type);
                $fp = fopen($file_path[2], "w");
                for ($i = 0; $i < $field_count; $i++) {
                    $filed_list .= $fields[$i]->name . ",";
                }
                fwrite($fp, utf82gb($filed_list) . "\n");
                $i = 1;
                while ($rs = mysqli_fetch_array($rows)) {
                    $f_list = "";
                    $i++;
                    for ($k = 0; $k < $field_count; $k++) {
                        $f_list .= $rs[$k] . ",";
                    }
                    $row_list = $f_list . "\n";
                    fwrite($fp, utf82gb($row_list));
                    if ($i % 100 == 0) {
                        ob_flush();
                        flush();
                    }
                }
                fclose($fp);
                unset($f_list);
                unset($row_list);
            } elseif ($file_type == "txt_n") {
                $file_path = excel_file("" . $file_name . "_", "txt");
                $fp = fopen($file_path[2], "w");
                $filed_list = "C011|130002|861300005101|dxhbfc|客户姓名|客户姓别|客户生日|客户手机号|销售日期|0|职业";
                fwrite($fp, utf82gb($filed_list) . "\r\n");
                $i = 1;
                while ($rs = mysqli_fetch_array($rows)) {
                    $f_list = "";
                    $i++;
                    for ($k = 0; $k < $field_count; $k++) {
                        $f_list .= $rs[$k] . "|";
                    }
                    $row_list = substr($f_list, 0, -1) . "\r\n";
                    fwrite($fp, utf82gb($row_list));
                    if ($i % 100 == 0) {
                        ob_flush();
                        flush();
                    }
                }
                fclose($fp);
                unset($f_list);
                unset($row_list);
            } else {
                //生成TXT文档
                $file_path = excel_file("" . $file_name . "_", $file_type);
                $fp = fopen($file_path[2], "w");
                for ($i = 0; $i < $field_count; $i++) {
                    $filed_list .= $fields[$i]->name . "\t";
                }
                fwrite($fp, utf82gb($filed_list) . "\r\n");
                $i = 1;
                while ($rs = mysqli_fetch_array($rows)) {
                    $f_list = "";
                    $i++;
                    for ($k = 0; $k < $field_count; $k++) {
                        $f_list .= $rs[$k] . "\t";
                    }
                    $row_list = $f_list . "\r\n";
                    fwrite($fp, utf82gb($row_list));
                    if ($i % 100 == 0) {
                        ob_flush();
                        flush();
                    }
                }
                fclose($fp);
                unset($f_list);
                unset($row_list);
            }
            $do_res = array("counts" => "1", "file_path" => gb2utf8(str_replace("./data/", "/data/", $file_path[1])), "file_name" => gb2utf8($file_path[0]), "des" => "文件导出完成,请点击下载!");
        } else {
            $do_res = array("counts" => "0", "file_path" => "", "file_name" => "", "des" => "未找到符合条件的数据...");
        }
    } else {
        $do_res = array("counts" => "-1", "file_path" => "", "file_name" => "", "des" => "数据查询条件有误,请检查后重试...");
    }
    return $do_res;
    mysqli_free_result($rows);
}
コード例 #18
0
function changyan_autoCharset($msg, $type = 'out')
{
    global $cfg_soft_lang;
    if ($cfg_soft_lang == 'gb2312') {
        if ($type == 'out') {
            return gb2utf8($msg);
        } else {
            return utf82gb($msg);
        }
    }
    return $msg;
}
コード例 #19
0
ファイル: friendlink_check.php プロジェクト: soonfine/leread
     $rs['huilian'] = "<font color=red>²éѯʧ°Ü£¬ÇëÖØÊÔ</font>";
 } else {
     preg_match_all("/<a[^>]*?http:\\/\\/[^>]*?>.*?<\\/a>/i", $output, $mt);
     if (preg_match('/charset=utf-8/i', $output)) {
         $char = 'utf-8';
     }
     $v = array();
     $n = 0;
     foreach ($mt[0] as $r) {
         if (strpos($r, $url) === false) {
             $n++;
         }
         if (strpos($r, $myurl) !== false) {
             $hlname = strip_tags($r);
             if (!empty($char) && $cfg_soft_lang != $char) {
                 $hlname = utf82gb($hlname);
             } elseif (empty($char) && $cfg_soft_lang != 'gb2312') {
                 $hlname = gb2utf8($hlname);
             }
         }
     }
     if (empty($hlname)) {
         $rs['huilian'] = "<font color=red>Ê×Ò³ÎÞ±¾Õ¾Á´½Ó</font>";
     } else {
         $rs['huilian'] = "Á´½Ó:" . $hlname . " ÍâÁ´Êý:" . $n;
     }
 }
 if ($cfg_soft_lang == 'gb2312') {
     $rs['huilian'] = gb2utf8($rs['huilian']);
 }
 echo json_encode($rs);
コード例 #20
0
ファイル: cjx.class.php プロジェクト: soonfine/leread
 function ac_import()
 {
     global $cfg_soft_lang;
     $id = $this->gv("id");
     $sub = $this->gv('sub');
     if (empty($sub)) {
         $this->display();
     } else {
         $all = 0;
         $index = 0;
         $con = $this->gv('con');
         if (empty($con)) {
             showmsg("尚未输入采集规则", -1);
             exit;
         }
         $cons = explode("---", $con);
         foreach ($cons as $r) {
             $index++;
             if (!empty($r)) {
                 //$test = explode("#",$r);
                 //if(count($test)<=4){
                 //echo "{$index}、规则不规范,请不要修改规则<br>";continue;
                 //}
                 $r = stripslashes($r);
                 if (!empty($r) && preg_match("/<data(.*)<\\/data>/siU", $r, $mt)) {
                     $n = strpos($mt[1], '>');
                     $s = trim(substr($mt[1], 0, $n));
                     $e = trim(substr($mt[1], $n + 1));
                     $s = str_replace(array(" ", '"'), array("&", ""), $s);
                     @parse_str($s, $arr);
                     if (count($arr) != 5) {
                         echo "{$index}、无法识别规则<br>";
                         continue;
                     }
                     $hash = md5($e);
                     if ($hash != $arr['hash']) {
                         //echo "{$index}、非法规则<br>";continue;
                     }
                     if ($arr['charset'] != $cfg_soft_lang) {
                         if ($arr['charset'] == 'gb2312') {
                             $e = gb2utf8($e);
                         } else {
                             $e = utf82gb($e);
                         }
                     }
                     $d['typeid'] = $id;
                     $d['type'] = $arr['type'];
                     if ($d['type'] != 0) {
                         $d['keyword'] = $e;
                         if (!cjxdb("kwkeyword")->where("keyword='{$d['keyword']}'")->find()) {
                             cjxdb("kwkeyword")->insert($d);
                         } else {
                             echo "{$index}、有相同规则已存在<br>";
                             continue;
                         }
                     } else {
                         $es = explode(',', $e);
                         foreach ($es as $er) {
                             $d['keyword'] = $er;
                             if (!cjxdb("kwkeyword")->where("keyword='{$d['keyword']}'")->find()) {
                                 cjxdb("kwkeyword")->insert($d);
                             } else {
                                 echo "{$index}、有相同规则已存在<br>";
                                 continue;
                             }
                         }
                     }
                     echo "{$index}、导入成功<br>";
                     $all++;
                 }
             }
         }
         showmsg("完成导入{$all}条规则", "?ac=task");
     }
 }
コード例 #21
0
function AnalyseHtmlBody($body, &$description, &$litpic, &$keywords, $dtype = '')
{
    global $autolitpic, $remote, $dellink, $autokey, $cfg_basehost, $cfg_auot_description, $id, $title, $cfg_soft_lang;
    $autolitpic = empty($autolitpic) ? '' : $autolitpic;
    $body = stripslashes($body);
    //远程图片本地化
    if ($remote == 1) {
        $body = GetCurContent($body);
    }
    //删除非站内链接
    if ($dellink == 1) {
        $basehost = "http://" . $_SERVER['HTTP_HOST'];
        $body = str_replace($cfg_basehost, '#basehost#', $body);
        $body = str_replace($basehost, '#2basehost2#', $body);
        $body = preg_replace("/(<a[ \t\r\n]{1,}href=[\"']{0,}http:\\/\\/[^\\/]([^>]*)>)|(<\\/a>)/isU", "", $body);
        $body = str_replace('#basehost#', $cfg_basehost, $body);
        $body = str_replace('#2basehost2#', $basehost, $body);
    }
    //自动摘要
    if ($description == '' && $cfg_auot_description > 0) {
        $description = cn_substr(html2text($body), $cfg_auot_description);
        $description = trim(preg_replace('/#p#|#e#/', '', $description));
        $description = addslashes($description);
    }
    //自动获取缩略图
    if ($autolitpic == 1 && $litpic == '') {
        $litpic = GetDDImgFromBody($body);
    }
    //自动获取关键字
    if ($autokey == 1 && $keywords == '') {
        $subject = $title;
        $message = $body;
        if ($cfg_soft_lang == 'utf-8') {
            $subject = utf82gb($title);
            $message = utf82gb($message);
        }
        include_once DEDEINC . '/splitword.class.php';
        $keywords = '';
        $sp = new SplitWord();
        $titleindexs = explode(' ', preg_replace("/#p#|#e#/", '', $sp->GetIndexText($subject)));
        $allindexs = explode(' ', preg_replace("/#p#|#e#/", '', $sp->GetIndexText(Html2Text($message), 500)));
        if (is_array($allindexs) && is_array($titleindexs)) {
            foreach ($titleindexs as $k) {
                if (strlen($keywords . $k) >= 60) {
                    break;
                } else {
                    $keywords .= $k . ',';
                }
            }
            foreach ($allindexs as $k) {
                if (strlen($keywords . $k) >= 60) {
                    break;
                } else {
                    if (!in_array($k, $titleindexs)) {
                        $keywords .= $k . ',';
                    }
                }
            }
        }
        $sp->Clear();
        $sp = null;
    }
    $body = GetFieldValueA($body, $dtype, $id);
    $body = addslashes($body);
    return $body;
}
コード例 #22
0
ファイル: index_do.php プロジェクト: hensonvip/ymroad
                            $dtime = time();
                            $ischeck = $cfg_mb_msgischeck == 'Y' ? 0 : 1;
                            if ($cfg_soft_lang == 'gb2312') {
                                $content = utf82gb(nl2br($content));
                            }
                            $content = cn_substrR(HtmlReplace($content, 1), 360);
                            //对表情进行解析
                            $content = addslashes(preg_replace("/\\[face:(\\d{1,2})\\]/is", "<img src='" . $cfg_memberurl . "/templets/images/smiley/\\1.gif' style='cursor: pointer; position: relative;'>", $content));
                            $content = RemoveXSS($content);
                            $inquery = "INSERT INTO `#@__member_msg`(`mid`,`userid`,`ip`,`ischeck`,`dtime`, `msg`)\n                   VALUES ('{$cfg_ml->M_ID}','{$cfg_ml->M_LoginID}','{$ip}','{$ischeck}','{$dtime}', '{$content}'); ";
                            $rs = $dsql->ExecuteNoneQuery($inquery);
                            if (!$rs) {
                                $output['type'] = 'error';
                                $output['data'] = '更新失败,请重试.';
                                exit;
                            }
                            $output['type'] = 'success';
                            if ($cfg_soft_lang == 'gb2312') {
                                $content = utf82gb(nl2br($content));
                            }
                            $output['data'] = stripslashes($content);
                            exit(json_encode($output));
                        }
                    }
                } else {
                    ShowMsg("本页面禁止返回!", "index.php");
                }
            }
        }
    }
}
コード例 #23
0
 function SplitRMM($str = '', $tryNumName = true, $tryDiff = true)
 {
     global $cfg_soft_lang;
     if ($cfg_soft_lang == 'utf-8' && !$this->isChange) {
         $this->isChange = true;
         $str = utf82gb($str);
     }
     $str = trim($str);
     //SetSource中不对$str作任何处理
     if ($str != '') {
         $this->SetSource($str);
     } else {
         return '';
     }
     //对文本进行粗分
     $this->SourceString = preg_replace('/ {1,}/', ' ', $this->ReviseString($this->SourceString));
     //对特定文本进行分离
     $spwords = explode(' ', $this->SourceString);
     $spLen = count($spwords) - 1;
     $spc = $this->SplitChar;
     for ($i = $spLen; $i >= 0; $i--) {
         //空白符号
         if (ord($spwords[$i][0]) < 33) {
             continue;
         } else {
             if (!isset($spwords[$i][$this->MinLen])) {
                 $this->ResultString = $spwords[$i] . $spc . $this->ResultString;
             } else {
                 if (ord($spwords[$i][0]) < 0x81) {
                     $this->ResultString = $spwords[$i] . $spc . $this->ResultString;
                 } else {
                     $this->ResultString = $this->RunRMM($spwords[$i], $tryNumName, $tryDiff) . $spc . $this->ResultString;
                 }
             }
         }
     }
     return $this->ResultString;
 }
コード例 #24
0
 $tjnum = $startdd;
 if ($limitSql != '') {
     $fquery = "Select arc.id,arc.title,arc.keywords,addon.body From `#@__archives` arc\r\n\t          left join `#@__addonarticle` addon on addon.aid=arc.id where arc.channel='1' {$limitSql} ";
     $dsql->SetQuery($fquery);
     $dsql->Execute();
     $sp = new SplitWord();
     while ($row = $dsql->GetObject()) {
         if ($row->keywords != '') {
             continue;
         }
         $tjnum++;
         $id = $row->id;
         $keywords = "";
         if ($cfg_soft_lang == 'utf-8') {
             $row->title = utf82gb($row->title);
             $row->body = utf82gb($row->body);
         }
         $titleindexs = explode(' ', trim($sp->GetIndexText($row->title)));
         $allindexs = explode(' ', trim($sp->GetIndexText(Html2Text($row->body), 500)));
         if (is_array($allindexs) && is_array($titleindexs)) {
             foreach ($titleindexs as $k) {
                 if (strlen($keywords) >= 30) {
                     break;
                 } else {
                     $keywords .= $k . ",";
                 }
             }
             foreach ($allindexs as $k) {
                 if (strlen($keywords) >= 30) {
                     break;
                 } else {
コード例 #25
0
ファイル: wapsearch.php プロジェクト: Miliup/miliofficeweb
{
    showmsg('参数不正确,高级自定义搜索必须指定模型id', 'javascript');
    exit();
}*/
$query = "SELECT maintable, mainfields, addontable, addonfields, template FROM #@__advancedsearch WHERE mid='{$mid}'";
$searchinfo = $dsql->GetOne($query);
if (!is_array($searchinfo)) {
    showmsg('自定义搜索模型不存在', '-1');
    exit;
}
$template = $searchinfo['template'] != '' ? $searchinfo['template'] : 'wapsearch.wml';
$sql = empty($_SESSION[$sqlhash]) ? '' : $_SESSION[$sqlhash];
if (empty($sql)) {
    //主表字段处理
    $q = stripslashes($q);
    $q = utf82gb($q);
    $q = preg_replace("#[\\|\"\r\n\t%\\*\\?\\(\\)\$;,'%<>]#", " ", trim($q));
    if ($cfg_notallowstr != '' && preg_match("#" . $cfg_notallowstr . "#i", $q) || $cfg_replacestr != '' && preg_match("#" . $cfg_replacestr . "#i", $q)) {
        echo "你的信息中存在非法内容,被系统禁止!<a href='javascript:history.go(-1)'>[返回]</a>";
        exit;
    }
    $q = addslashes($q);
    $iscommend = isset($iscommend) && is_numeric($iscommend) ? $iscommend : 0;
    $typeid = isset($typeid) && is_numeric($typeid) ? $typeid : 0;
    $typeid = max($typeid, 0);
    $includesons = isset($includesons) ? 1 : 0;
    $writer = isset($writer) ? trim($writer) : '';
    $source = isset($source) ? trim($source) : '';
    $startdate = isset($startdate) ? trim($startdate) : '';
    $enddate = isset($enddate) ? trim($enddate) : '';
    if ($startdate != '') {
コード例 #26
0
ファイル: string.helper.php プロジェクト: stonelf/mcgmh
 function GetPinyin($str, $ishead = 0, $isclose = 1)
 {
     global $cfg_soft_lang;
     if (!function_exists('SpGetPinyin')) {
         //全局函数仅是inc_fun_funAdmin.php文件中函数的一个映射
         require_once DEDEINC . "/inc/inc_fun_funAdmin.php";
     }
     if ($cfg_soft_lang == 'utf-8') {
         return SpGetPinyin(utf82gb($str), $ishead, $isclose);
     } else {
         return SpGetPinyin($str, $ishead, $isclose);
     }
 }
コード例 #27
0
 function TrimSymbol($str)
 {
   if(strtolower($this->CharSet)=="utf-8"){
   	$str = utf82gb($str);
   }
   else if(strtolower($this->CharSet)=="big5"){
   	$str = big52gb($str);
   }
   else if(!eregi("^gb",$this->CharSet)){
   	$this->NotEncodeText .= $str;
   	return "";
   }
   $str = trim($str);
   $slen = strlen($str);
   if($slen==0) return "";
   $okstr = "";
   for($i=0;$i<$slen;$i++){
     if(ord($str[$i]) < 0x81){
       //当字符为英文中的特殊符号
       if(ereg("[^0-9a-zA-Z@.%#:/\\&-]",$str[$i])){
         if($okstr!=""){ if( $okstr[strlen($okstr)-1]!=" " ) $okstr .= " "; }
       }
       //如果字符为非特殊符号
       else{
         if(strlen($okstr)>1){
           if(ord($okstr[strlen($okstr)-2])>0x80) $okstr .= " ".$str[$i];
           else $okstr .= $str[$i];
         }
         else $okstr .= $str[$i];
       }
     }
     else
     {
       //如果上一个字符为非中文和非空格,则加一个空格
       if(strlen($okstr)>1){
         if(ord($okstr[strlen($okstr)-2]) < 0x81 && $okstr[strlen($okstr)-1]!=" ")
         { $okstr .= " "; }
       }
       //如果中文字符
       if( isset($str[$i+1]) ){
         $c = $str[$i].$str[$i+1];
         $n = hexdec(bin2hex($c));
         if($n < 0xB0A1)
         {
             if($c=="《")
           {  $okstr .= " 《"; }
           else if($c=="》")
           {  $okstr .= "》 "; }
           else if($okstr[strlen($okstr)-1]!=" ")
           {  $okstr .= " ";  }
         }
         else{
           //F7 - FE 是GB2312的终结编码
           if($n < 0xF8FF) $okstr .= $c;
         }
         $i++;
       }
       else{
         $okstr .= $str[$i];
       }
     }
   }//结束循环
   return $okstr;
 }
コード例 #28
0
ファイル: sys_payment.php プロジェクト: hensonvip/ymroad
         $config = serialize($config);
     }
     $query = "UPDATE `#@__payment` SET name = '{$pay_name}',fee='{$pay_fee}',description='{$pay_desc}',config='{$config}',enabled='1' WHERE id='{$pid}'";
     $dsql->ExecuteNoneQuery($query);
     if ($pm == 'edit') {
         $msg = "保存修改成功";
     } else {
         $msg = "安装成功!";
     }
     ShowMsg($msg, "sys_payment.php");
     exit;
 } else {
     if ($dopost == 'uninstall') {
         $row = $dsql->GetOne("SELECT * FROM `#@__payment` WHERE id='{$pid}'");
         if ($cfg_soft_lang == 'utf-8') {
             $config = AutoCharset(unserialize(utf82gb($row['config'])));
         } else {
             if ($cfg_soft_lang == 'gb2312') {
                 $config = unserialize($row['config']);
             }
         }
         foreach ($config as $key => $v) {
             $config[$key]['value'] = "";
         }
         if ($cfg_soft_lang == 'utf-8') {
             $config = AutoCharset($config, 'utf-8', 'gb2312');
             $config = serialize($config);
             $config = gb2utf8($config);
         } else {
             $config = serialize($config);
         }
コード例 #29
0
ファイル: index.php プロジェクト: klr2003/sourceread
<?php

require_once dirname(__FILE__) . '/config.php';
if (empty($uid)) {
    $uid = '';
} else {
    $tmpstr = @gb2utf8($uid);
    $tmpstr2 = @utf82gb($tmpstr);
    if ($tmpstr2 == $uid) {
        $uid = $tmpstr;
    }
}
if (empty($action)) {
    $action = '';
}
if (empty($aid)) {
    $aid = '';
}
//会员后台
if ($uid == '') {
    $iscontrol = 'yes';
    if (!$cfg_ml->IsLogin()) {
        include_once dirname(__FILE__) . "/templets/index-notlogin.htm";
        exit;
    } else {
        $minfos = $dsql->GetOne("Select * From `#@__member_tj` where mid='" . $cfg_ml->M_ID . "'; ");
        $minfos['totaluse'] = $cfg_ml->GetUserSpace();
        $minfos['totaluse'] = number_format($minfos['totaluse'] / 1024 / 1024, 2);
        if ($cfg_mb_max > 0) {
            $ddsize = ceil($minfos['totaluse'] / $cfg_mb_max * 100);
        } else {