本文整理汇总了PHP中pwConvert函数的典型用法代码示例。如果您正苦于以下问题:PHP pwConvert函数的具体用法?PHP pwConvert怎么用?PHP pwConvert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pwConvert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getEmailAddressList
/**
* 获得好友列表
*/
function _getEmailAddressList()
{
if (!$this->header['sid']) {
return 0;
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://" . $this->header['host'] . "/a/s?sid=" . $this->header['sid'] . "&func=global:sequential");
curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIEJAR3);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept-Language: zh-cn', 'Connection: Keep-Alive', 'Content-Type: application/xml; charset=UTF-8'));
$str = "<?xml version=\"1.0\"?><object><array name=\"items\"><object><string name=\"func\">pab:searchContacts</string>" . "<object name=\"var\"><array name=\"order\"><object><string name=\"field\">FN</string><boolean name=\"ignoreCase\">true</boolean></object>" . "</array></object></object><object><string name=\"func\">user:getSignatures</string></object>" . "<object><string name=\"func\">pab:getAllGroups</string></object></array></object>";
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $str);
curl_setopt($ch, CURLOPT_TIMEOUT, TIMEOUT);
ob_start();
curl_exec($ch);
$contents = ob_get_contents();
ob_end_clean();
curl_close($ch);
$contents = pwConvert($contents, 'GBK', 'UTF-8');
preg_match_all("/<string\\s*name=\"EMAIL;PREF\">(.*)<\\/string>/Umsi", $contents, $mails);
preg_match_all("/<string\\s*name=\"FN\">(.*)<\\/string>/Umsi", $contents, $names);
foreach ($names[1] as $k => $user) {
$this->addressList[$mails[1][$k]] = $user;
}
}
示例2: update
function update($uploaddb)
{
global $db_charset, $timestamp;
foreach ($uploaddb as $key => $value) {
$value['name'] = pwConvert($value['name'], $db_charset, 'utf-8');
$this->db->update("INSERT INTO pw_attachs SET " . pwSqlSingle(array('fid' => 0, 'uid' => $this->uid, 'tid' => 0, 'pid' => 0, 'hits' => 0, 'name' => $value['name'], 'type' => $value['type'], 'size' => $value['size'], 'attachurl' => $value['fileuploadurl'], 'uploadtime' => $timestamp, 'ifthumb' => $value['ifthumb'])));
}
}
示例3: update
function update($uploaddb)
{
global $db_charset, $timestamp;
foreach ($uploaddb as $key => $value) {
$value['name'] = pwConvert($value['name'], $db_charset, 'utf-8');
$this->db->update("INSERT INTO pw_attachs SET " . S::sqlSingle(array('fid' => 0, 'uid' => $this->uid, 'tid' => 0, 'pid' => 0, 'hits' => 0, 'name' => $value['name'], 'type' => $value['type'], 'size' => $value['size'], 'attachurl' => $value['fileuploadurl'], 'uploadtime' => $timestamp, 'ifthumb' => $value['ifthumb'])));
$aid = $this->db->insert_id();
$this->attachs[$aid] = array('aid' => $aid, 'name' => stripslashes($value['name']), 'type' => $value['type'], 'attachurl' => $value['fileuploadurl'], 'needrvrc' => $value['needrvrc'], 'special' => $value['special'], 'ctype' => $value['ctype'], 'size' => $value['size'], 'hits' => 0, 'desc' => str_replace('\\', '', $value['descrip']), 'ifthumb' => $value['ifthumb']);
}
return true;
}
示例4: pwConvert
function pwConvert($str, $toEncoding, $fromEncoding, $ifMb = true)
{
if (strtolower($toEncoding) == strtolower($fromEncoding)) {
return $str;
}
if (is_array($str)) {
foreach ($str as $key => $value) {
$str[$key] = pwConvert($value, $toEncoding, $fromEncoding, $ifMb);
}
return $str;
} else {
return mb_convert_encoding($str, $toEncoding, $fromEncoding);
}
}
示例5: getEmailAddressList
/**
* 根据用户名密码获得 man 联系人email地址列表
* @param string $username
* @param string $password
* @return array
*/
function getEmailAddressList($username, $password)
{
if (!$this->_login($username, $password)) {
return 0;
}
$_emails = array();
$_count = 0;
//获得联系人列表
$this->_put("SYN {$this->trID} 0 0");
$this->_get();
$this->_put("CHG {$this->trID} NLN");
$stream_info = stream_get_meta_data($this->fp);
while (!feof($this->fp) && !$stream_info['timed_out'] && $_count <= 1) {
$data = $this->_get();
$stream_info = stream_get_meta_data($this->fp);
if ($data) {
switch ($code = substr($data, 0, 3)) {
default:
break;
case 'MSG':
$_count++;
break;
case 'LST':
$_emails[] = $data;
break;
case 'SYN':
break;
case 'CHL':
$bits = explode(' ', trim($data));
$return = md5($bits[2] . MD5STRING);
$this->_put("QRY {$this->trID} msmsgs@msnmsgr.com 32{$return}");
break;
}
}
}
$_addressList = array();
foreach ($_emails as $key => $value) {
if (strpos($value, 'C=')) {
$value = pwConvert($value, 'GBK', 'UTF-8');
$_friends = explode(' ', $value);
$_addressList[substr($_friends[1], 2)] = substr($_friends[2], 2);
}
}
return $_addressList;
}
示例6: _getEmailAddressList
/**
* 获得好友列表
*/
function _getEmailAddressList()
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->listUrl);
curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIEJAR2);
curl_setopt($ch, CURLOPT_TIMEOUT, TIMEOUT);
ob_start();
curl_exec($ch);
$contents = ob_get_contents();
ob_end_clean();
curl_close($ch);
$contents = pwConvert($contents, 'GBK', 'UTF-8');
preg_match_all("/\"DisplayName\":\"([^\"]*)\"/is", $contents, $names);
preg_match_all("/\"Address\":\"([^\"]*)\"/is", $contents, $emails);
foreach ($names[1] as $k => $user) {
$this->addressList[$emails[1][$k]] = $user;
}
}
示例7: foreach
}
if ($db_charset == 'utf-8' || $db_charset == 'big5') {
foreach ($rt as $key => $value) {
$rt[$key] = pwConvert($value, 'gbk', $db_charset);
}
}
$memberdb[] = $rt;
}
$titledb = array(getLangInfo('other', 'pc_id') . "\t", getLangInfo('other', 'pc_username') . "\t", getLangInfo('other', 'pc_name') . "\t", getLangInfo('other', 'pc_mobile') . "\t", getLangInfo('other', 'pc_phone') . "\t", getLangInfo('other', 'pc_address') . "\t", getLangInfo('other', 'pc_zip') . "\t", getLangInfo('other', 'pc_nums') . "\t", getLangInfo('other', 'pc_totalcash') . "\t", getLangInfo('other', 'pc_message') . "\t", getLangInfo('other', 'pc_ifpay') . "\t\n");
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:attachment;filename={$read['subject']}.xls");
header("Pragma: no-cache");
header("Expires: 0");
foreach ($titledb as $key => $value) {
if ($db_charset == 'utf-8' || $db_charset == 'big5') {
$value = pwConvert($value, 'gbk', $db_charset);
}
echo $value;
}
$i = 0;
foreach ($memberdb as $val) {
$i++;
$val['message'] = str_replace("\n", "", $val['message']);
echo "{$i}\t";
echo "{$val['username']}\t";
echo "{$val['name']}\t";
echo "{$val['mobile']}\t";
echo "{$val['phone']}\t";
echo "{$val['address']}\t";
echo "{$val['zip']}\t";
echo "{$val['nums']}\t";
示例8: newClass
$class = newClass($newclass);
}
$class_title = $db->get_value("SELECT title FROM pw_filter_class WHERE id=" . S::sqlEscape($class));
//更改分类状态
setClassState($class, $state);
require_once R_P . 'require/posthost.php';
//获取中心词库词语数量
$app_num = $db->get_value("SELECT COUNT(*) AS count FROM pw_wordfb WHERE custom = 0");
if (empty($app_num)) {
//重新同步中心词库
$data = PostHost($updateHost, "m=wordsfb&a=restart&sitehash={$sitehash}", "POST");
} else {
//同步中心词库
$data = PostHost($updateHost, "m=wordsfb&a=update&sitehash={$sitehash}", "POST");
}
$content = pwConvert(unserialize($data), $db_charset, 'UTF8');
$list = array();
if (is_array($content)) {
$i = 0;
foreach ($content as $key => $value) {
if ($value['word']) {
$id = $db->get_value("SELECT id FROM pw_wordfb WHERE word=" . S::sqlEscape($value['word']));
if (empty($id)) {
$sql = "INSERT INTO pw_wordfb (word,wordreplace,type,wordtime,classid) VALUES (" . S::sqlEscape($value['word']) . ", '*****', " . S::sqlEscape($center_level[$value['level']]) . ", " . S::sqlEscape($timestamp) . ", " . S::sqlEscape($class) . " )";
$db->update($sql);
$list[] = array('word' => $value['word'], 'level' => $center_level[$value['level']]);
$i++;
}
}
}
//更新缓存
示例9: getCatevalue
function getCatevalue($pcid, $pcdb = array())
{
/*帖子内容显示*/
global $tid, $db_charset;
$newpostcatevalue = $postcatevalue = $flashcatevalue = '';
$newpostcatevalue .= "<div class=\"cates\">";
$flashcatevalue .= "<div class=\"cate_meg_player\" ><div id=\"pwSlidePlayer\" class=\"readFlash\">";
$postcatevalue .= "<ul class=\"cate-list\">";
if (!isset($this->postcatedb[$pcid])) {
return;
}
if (isset($pcdb) && count($pcdb) > 0) {
$fieldone = $pcdb;
} else {
$pcid = (int) $pcid;
$pcvaluetable = GetPcatetable($pcid);
$fieldone = $this->db->get_one("SELECT pv.*,SUM(pm.nums) as nums FROM {$pcvaluetable} pv LEFT JOIN pw_pcmember pm ON pv.tid=pm.tid WHERE pv.tid=" . S::sqlEscape($tid) . " GROUP BY pv.tid");
}
$query = $this->db->query("SELECT fieldid,fieldname,name,rules,type,vieworder FROM pw_pcfield WHERE pcid=" . S::sqlEscape($pcid) . " ORDER BY vieworder,fieldid");
$vieworder_mark = $i = $tmpCount = 0;
$flash = false;
while ($rt = $this->db->fetch_array($query)) {
if (($rt['type'] == 'img' || $rt['type'] == 'upload') && $fieldone[$rt['fieldname']]) {
$tmpCount++;
$rt['type'] == 'upload' && ($fieldone[$rt['fieldname']] = postCate::getpcurl($fieldone[$rt['fieldname']], 1));
$flashcatevalue .= "<div class=\"readFlash\" id=\"Switch_{$rt['fieldname']}\" style=\"display:none;\"><img src=\"{$fieldone[$rt[fieldname]]}\"/></div>";
$flash = true;
}
if ($rt['type'] == 'textarea') {
$fieldone[$rt['fieldname']] = nl2br($fieldone[$rt['fieldname']]);
}
$rt['fieldvalue'] = $fieldone[$rt['fieldname']];
if ((S::isNatualValue($rt['fieldvalue']) || $rt['fieldname'] == 'limitnum') && $rt['type'] != 'img' && $rt['type'] != 'upload') {
$classname = $i % 2 == 0 ? 'two' : '';
$rt['rules'] && ($rt['rules'] = unserialize($rt['rules']));
list($rt['name1'], $rt['name2']) = explode('{#}', $rt['name']);
if ($rt['fieldname'] == 'limitnum') {
!$rt['fieldvalue'] && ($rt['fieldvalue'] = getLangInfo('other', 'pc_limitnum'));
}
if ($rt['fieldname'] == 'mprice') {
$rt['fieldvalue'] = '<span style="text-decoration:line-through">' . $rt['fieldvalue'] . '</span>';
}
if ($rt['fieldname'] == 'wangwang') {
$wang = '';
$wang = rawurlencode(pwConvert($rt['fieldvalue'], 'utf-8', $db_charset));
$rt['fieldvalue'] .= ' <a target="_blank" href="http://amos1.taobao.com/msg.ww?v=2&uid=' . $wang . '&s=1" ><img border="0" src="http://amos1.taobao.com/online.ww?v=2&uid=' . $wang . '&s=1" alt="' . getLangInfo('other', 'pc_wangwang') . '" /></a>';
}
if ($rt['vieworder'] != $vieworder_mark && $vieworder_mark != 0) {
$postcatevalue .= "</cite></li>";
}
if ($rt['vieworder'] == 0) {
$postcatevalue .= "<li class=\"{$classname}\"><em>{$rt['name1']}:</em><cite>";
$postcatevalue .= $this->getFieldValueHTML($rt['type'], $rt['fieldvalue'], $rt['rules']);
$postcatevalue .= $rt['name2'] . "</cite></li>";
$i++;
} else {
if ($vieworder_mark != $rt['vieworder']) {
$postcatevalue .= "<li class=\"{$classname}\"><em>{$rt['name1']}:</em><cite>";
$postcatevalue .= $this->getFieldValueHTML($rt['type'], $rt['fieldvalue'], $rt['rules']);
$postcatevalue .= "{$rt['name2']}";
$i++;
} else {
$postcatevalue .= "{$rt['name1']}";
$postcatevalue .= $this->getFieldValueHTML($rt['type'], $rt['fieldvalue'], $rt['rules']);
$postcatevalue .= "{$rt['name2']}";
}
}
$vieworder_mark = $rt['vieworder'];
}
}
$flashcatevalue .= "<ul class=\"b\" id=\"SwitchNav\"></ul><div></div></div></div><script type=\"text/javascript\" src=\"js/sliderplayer.js\"></script><script type=\"text/javascript\">pwSliderPlayers('pwSlidePlayer');</script>";
$vieworder_mark != 0 && ($postcatevalue .= "</cite></li>");
$postcatevalue .= "</ul></div>";
$flash == false && ($flashcatevalue = '');
$newpostcatevalue .= $flashcatevalue . $postcatevalue;
return array($fieldone, $newpostcatevalue);
}
示例10: run
function run($request)
{
$request = $this->strips($request);
if (isset($request['type']) && $request['type'] == 'uc') {
$this->type = 'uc';
$this->apikey = $GLOBALS['uc_key'];
} else {
$this->type = 'app';
$this->apikey = $GLOBALS['db_siteownerid'];
$this->siteappkey = $GLOBALS['db_siteappkey'];
}
/***
if ($this->type == 'app' && !$GLOBALS['o_appifopen']) {
return new ErrorMsg(API_CLOSED, 'App Closed');
}
***/
ksort($request);
reset($request);
$arg = '';
foreach ($request as $key => $value) {
if ($value && $key != 'sig') {
$arg .= "{$key}={$value}&";
}
}
if (empty($this->apikey) || md5($arg . $this->apikey) != $request['sig']) {
return new ErrorMsg(API_SIGN_ERROR, 'Error Sign');
}
$mode = $request['mode'];
$method = $request['method'];
$params = isset($request['params']) ? unserialize($request['params']) : array();
if (isset($params['appthreads'])) {
if (PHP_VERSION < 5.2) {
require_once R_P . 'api/class_json.php';
$json = new Services_JSON(true);
$params['appthreads'] = $json->decode(@gzuncompress($params['appthreads']));
} else {
$params['appthreads'] = json_decode(@gzuncompress($params['appthreads']), true);
}
}
if ($params && isset($request['charset'])) {
$params = pwConvert($params, $this->charset, $request['charset']);
}
return $this->callback($mode, $method, $params);
}
示例11: pwConvert
$windid = pwConvert($windid, 'gbk', $db_charset);
$uptitle = pwConvert($uptitle, 'gbk', $db_charset);
$para = array('tid' => $rt['tid'], 'cid' => $cid, 'upposter' => $windid, 'uptitle' => $uptitle, 'subject' => $subject, 'rf' => $pwServer['HTTP_REFERER'], 'sitehash' => $db_sitehash, 'action' => 'updata');
ksort($para);
reset($para);
$arg = '';
foreach ($para as $key => $value) {
$arg .= "{$key}=" . urlencode($value) . "&";
}
$verify = md5(substr($arg, 0, -1) . $partner);
if (strpos($content, '[attachment=') !== false) {
preg_replace("/\\[attachment=([0-9]+)\\]/eis", "upload('\\1')", $content, $db_cvtimes);
}
$data = PostHost("http://app.phpwind.net/pw_app.php?", "action=updata&tid={$rt['tid']}&cid={$cid}&upposter={$windid}&uptitle={$uptitle}&sitehash={$db_sitehash}&subject=" . urlencode($subject) . "&content=" . urlencode($content) . "&verify={$verify}&rf=" . urlencode($pwServer['HTTP_REFERER']), "POST");
$backdata = substr($data, strpos($data, '$backdata=') + 10);
$backdata = pwConvert($backdata, $db_charset, 'gbk');
Showmsg($backdata);
} elseif ($q == 'survey') {
//* @include_once pwCache::getPath(D_P . "data/bbscache/survey_cache.php");
pwCache::getData(D_P . "data/bbscache/survey_cache.php");
require_once R_P . 'require/header.php';
S::gp(array('itemid'), 'G', 2);
if (!$itemid) {
foreach ($survey_cache as $itemdb) {
$itemid = $itemdb['itemid'] > $itemid ? $itemdb['itemid'] : $itemid;
}
}
$survey = $survey_cache[$itemid];
require_once PrintEot('apps');
footer();
} elseif ($q == 'appthread') {
示例12: pwConvert
function pwConvert($str, $to_encoding, $from_encoding, $ifmb = true)
{
if (strtolower($to_encoding) == strtolower($from_encoding)) {
return $str;
}
if (is_array($str)) {
foreach ($str as $key => $value) {
$str[$key] = pwConvert($value, $to_encoding, $from_encoding, $ifmb);
}
return $str;
} else {
if (function_exists('mb_convert_encoding') && $ifmb) {
return mb_convert_encoding($str, $to_encoding, $from_encoding);
} else {
static $pwconvert = null;
!$to_encoding && ($to_encoding = 'GBK');
!$from_encoding && ($from_encoding = 'GBK');
if (!isset($pwconvert) && !is_object($pwconvert)) {
require_once R_P . 'm/chinese.php';
$pwconvert = new Chinese();
}
return $pwconvert->Convert($str, $from_encoding, $to_encoding, !$ifmb);
}
}
}
示例13: addslashes
$filenames = addslashes($filenames);
checkVerify('swfhash');
$rt = $db->get_one("SELECT aname,photonum,ownerid,private,lastphoto,atype FROM pw_cnalbum WHERE aid=" . S::sqlEscape($aid));
if (empty($rt)) {
Showmsg('undefined_action');
}
if ($rt['atype'] == 1) {
$colony = $db->get_one("SELECT c.*,cm.id AS ifcyer FROM pw_colonys c LEFT JOIN pw_cmembers cm ON c.id=cm.colonyid AND cm.uid=" . S::sqlEscape($uid) . " WHERE c.id=" . S::sqlEscape($rt['ownerid']));
$level = $colony['speciallevel'] ? $colony['speciallevel'] : $colony['commonlevel'];
$o_maxphotonum = $db->get_value("SELECT maxphotonum FROM pw_cnlevel WHERE id=" . S::sqlEscape($level));
} else {
$uid != $rt['ownerid'] && Showmsg('colony_phototype');
}
$o_maxphotonum && $rt['photonum'] >= $o_maxphotonum && Showmsg('colony_photofull');
foreach ($_FILES as $key => $value) {
$_FILES[$key]['name'] = pwConvert($value['name'], $db_charset, 'utf-8');
}
L::loadClass('photoupload', 'upload', false);
$img = new PhotoUpload($aid, $rt['atype']);
PwUpload::upload($img);
pwFtpClose($ftp);
if (!($photos = $img->getAttachs())) {
Showmsg('colony_uploadnull');
}
$photoNum = count($photos);
$pid = $img->getNewID();
$photos[0]['pid'] = $pid;
$lastpid = getLastPid($aid, 4);
array_unshift($lastpid, $pid);
if ($rt['atype'] == 1) {
$cyid = $rt['ownerid'];
示例14: Showmsg
if (!$groupRight['modeset']['write']['ifopen']) {
Showmsg('gwrite_closed');
}
if (!$ifadmin && (!$colony['ifcyer'] || $colony['ifadmin'] == '-1')) {
Showmsg('colony_cnmenber');
}
banUser();
S::gp(array('id', 'source', 'encode', 'tosign'));
$ruid = 0;
$minLenText = 3;
$maxLenText = 255;
$text = S::getGP('text', 'P');
if (!S::inArray(strtolower($encode), array('gbk', 'utf8', 'big5'))) {
$encode = $charset;
} elseif ($charset != $encode) {
$text = pwConvert($text, $charset, $encode, true);
}
$textlen = strlen(html_entity_decode(stripslashes(trim($text))));
$textlen < $minLenText && Showmsg('mode_o_write_textminlen');
$textlen > $maxLenText && Showmsg('mode_o_write_textmaxlen');
$text2 = trim($text);
require_once R_P . 'require/bbscode.php';
$wordsfb = L::loadClass('FilterUtil', 'filter');
if (($banword = $wordsfb->comprise($text2)) !== false) {
Showmsg('content_wordsfb');
}
$rt = $db->get_one("SELECT postdate,content FROM pw_cwritedata WHERE uid=" . S::sqlEscape($winduid) . " and cyid=" . S::sqlEscape($cyid) . " ORDER BY id DESC LIMIT 1");
if ($rt['content'] == $text2) {
Showmsg('mode_o_write_sametext');
} elseif ($timestamp - $rt['postdate'] < 1) {
Showmsg('mode_o_write_timelimit');
示例15: pwConvert
/**
* 编码转换
*
* @uses Chinese
* @param string $str 内容字符串
* @param string $toEncoding 转为新编码
* @param string $fromEncoding 原编码
* @param bool $ifMb 是否使用mb函数
* @return string
*/
function pwConvert($str, $toEncoding, $fromEncoding, $ifMb = true)
{
if (strtolower($toEncoding) == strtolower($fromEncoding)) {
return $str;
}
is_object($str) && ($str = get_object_vars($str));
//fixed: object can't convert, by alacner 2010/09/15
if (is_array($str)) {
foreach ($str as $key => $value) {
is_object($value) && ($value = get_object_vars($value));
$str[$key] = pwConvert($value, $toEncoding, $fromEncoding, $ifMb);
}
return $str;
} else {
if (function_exists('mb_convert_encoding') && $ifMb) {
return mb_convert_encoding($str, $toEncoding, $fromEncoding);
} else {
static $sConvertor = null;
!$toEncoding && ($toEncoding = 'GBK');
!$fromEncoding && ($fromEncoding = 'GBK');
if (!isset($sConvertor) && !is_object($sConvertor)) {
L::loadClass('Chinese', 'utility/lang', false);
$sConvertor = new Chinese();
}
return $sConvertor->Convert($str, $fromEncoding, $toEncoding, !$ifMb);
}
}
}