本文整理汇总了PHP中convert_encoding函数的典型用法代码示例。如果您正苦于以下问题:PHP convert_encoding函数的具体用法?PHP convert_encoding怎么用?PHP convert_encoding使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了convert_encoding函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
function login($_username, $_password)
{
if (H::valid_email($_username)) {
// 使用 E-mail 登录
list($uc_uid, $username, $password, $email) = uc_user_login($_username, $_password, 2);
}
if ($this->ucenter_charset != 'utf-8') {
$username = convert_encoding($username, $this->ucenter_charset, 'UTF-8');
}
if (!$uc_uid) {
if ($this->ucenter_charset != 'utf-8') {
list($uc_uid, $username, $password, $email) = uc_user_login(convert_encoding($_username, 'utf-8', $this->ucenter_charset), $_password);
if ($username) {
$username = convert_encoding($username, $this->ucenter_charset, 'UTF-8');
}
} else {
list($uc_uid, $username, $password, $email) = uc_user_login($_username, $_password);
}
}
if ($username) {
$username = htmlspecialchars($username);
}
if ($uc_uid > 0) {
if (!($user_info = $this->get_uc_user_info($uc_uid))) {
if ($site_user_info = $this->model('account')->get_user_info_by_email($email)) {
$this->insert('users_ucenter', array('uid' => $site_user_info['uid'], 'uc_uid' => $uc_uid, 'username' => $username, 'email' => $email));
return false;
}
if ($new_user_id = $this->model('account')->user_register($username, $_password, $email, TRUE)) {
if ($exists_uc_id = $this->is_uc_user($email)) {
$this->update('users_ucenter', array('username' => $username, 'uid' => $new_user_id), 'uc_uid = ' . intval($exists_uc_id));
} else {
$this->insert('users_ucenter', array('uid' => $new_user_id, 'uc_uid' => $uc_uid, 'username' => $username, 'email' => $email));
}
$user_info = $this->model('account')->get_user_info_by_uid($new_user_id, true, false);
}
} else {
// Update password
$this->model('account')->update_user_password_ingore_oldpassword($_password, $user_info['uid'], $user_info['salt']);
// Update username
if ($user_info['user_name'] != $username) {
if (!$this->model('account')->check_username($username)) {
$this->model('account')->update_user_name($username, $user_info['uid']);
$this->update('users_ucenter', array('username' => htmlspecialchars($username)), 'uc_uid = ' . intval($uc_uid));
}
}
}
}
return $user_info;
}
示例2: Pinyin
function Pinyin($_String)
{
static $_Data;
global $mcharset;
if (empty($_Data)) {
$_DataKey = 'a|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao|ce|ceng|cha' . '|chai|chan|chang|chao|che|chen|cheng|chi|chong|chou|chu|chuai|chuan|chuang|chui|chun|chuo|ci|cong|cou|cu' . '|cuan|cui|cun|cuo|da|dai|dan|dang|dao|de|deng|di|dian|diao|die|ding|diu|dong|dou|du|duan|dui|dun|duo|e|en|er' . '|fa|fan|fang|fei|fen|feng|fo|fou|fu|ga|gai|gan|gang|gao|ge|gei|gen|geng|gong|gou|gu|gua|guai|guan|guang|gui' . '|gun|guo|ha|hai|han|hang|hao|he|hei|hen|heng|hong|hou|hu|hua|huai|huan|huang|hui|hun|huo|ji|jia|jian|jiang' . '|jiao|jie|jin|jing|jiong|jiu|ju|juan|jue|jun|ka|kai|kan|kang|kao|ke|ken|keng|kong|kou|ku|kua|kuai|kuan|kuang' . '|kui|kun|kuo|la|lai|lan|lang|lao|le|lei|leng|li|lia|lian|liang|liao|lie|lin|ling|liu|long|lou|lu|lv|luan|lue' . '|lun|luo|ma|mai|man|mang|mao|me|mei|men|meng|mi|mian|miao|mie|min|ming|miu|mo|mou|mu|na|nai|nan|nang|nao|ne' . '|nei|nen|neng|ni|nian|niang|niao|nie|nin|ning|niu|nong|nu|nv|nuan|nue|nuo|o|ou|pa|pai|pan|pang|pao|pei|pen' . '|peng|pi|pian|piao|pie|pin|ping|po|pu|qi|qia|qian|qiang|qiao|qie|qin|qing|qiong|qiu|qu|quan|que|qun|ran|rang' . '|rao|re|ren|reng|ri|rong|rou|ru|ruan|rui|run|ruo|sa|sai|san|sang|sao|se|sen|seng|sha|shai|shan|shang|shao' . '|she|shen|sheng|shi|shou|shu|shua|shuai|shuan|shuang|shui|shun|shuo|si|song|sou|su|suan|sui|sun|suo|ta|tai' . '|tan|tang|tao|te|teng|ti|tian|tiao|tie|ting|tong|tou|tu|tuan|tui|tun|tuo|wa|wai|wan|wang|wei|wen|weng|wo|wu' . '|xi|xia|xian|xiang|xiao|xie|xin|xing|xiong|xiu|xu|xuan|xue|xun|ya|yan|yang|yao|ye|yi|yin|ying|yo|yong|you' . '|yu|yuan|yue|yun|za|zai|zan|zang|zao|ze|zei|zen|zeng|zha|zhai|zhan|zhang|zhao|zhe|zhen|zheng|zhi|zhong' . '|zhou|zhu|zhua|zhuai|zhuan|zhuang|zhui|zhun|zhuo|zi|zong|zou|zu|zuan|zui|zun|zuo';
$_DataValue = '-20319|-20317|-20304|-20295|-20292|-20283|-20265|-20257|-20242|-20230|-20051|-20036|-20032|-20026|-20002|-19990' . '|-19986|-19982|-19976|-19805|-19784|-19775|-19774|-19763|-19756|-19751|-19746|-19741|-19739|-19728|-19725' . '|-19715|-19540|-19531|-19525|-19515|-19500|-19484|-19479|-19467|-19289|-19288|-19281|-19275|-19270|-19263' . '|-19261|-19249|-19243|-19242|-19238|-19235|-19227|-19224|-19218|-19212|-19038|-19023|-19018|-19006|-19003' . '|-18996|-18977|-18961|-18952|-18783|-18774|-18773|-18763|-18756|-18741|-18735|-18731|-18722|-18710|-18697' . '|-18696|-18526|-18518|-18501|-18490|-18478|-18463|-18448|-18447|-18446|-18239|-18237|-18231|-18220|-18211' . '|-18201|-18184|-18183|-18181|-18012|-17997|-17988|-17970|-17964|-17961|-17950|-17947|-17931|-17928|-17922' . '|-17759|-17752|-17733|-17730|-17721|-17703|-17701|-17697|-17692|-17683|-17676|-17496|-17487|-17482|-17468' . '|-17454|-17433|-17427|-17417|-17202|-17185|-16983|-16970|-16942|-16915|-16733|-16708|-16706|-16689|-16664' . '|-16657|-16647|-16474|-16470|-16465|-16459|-16452|-16448|-16433|-16429|-16427|-16423|-16419|-16412|-16407' . '|-16403|-16401|-16393|-16220|-16216|-16212|-16205|-16202|-16187|-16180|-16171|-16169|-16158|-16155|-15959' . '|-15958|-15944|-15933|-15920|-15915|-15903|-15889|-15878|-15707|-15701|-15681|-15667|-15661|-15659|-15652' . '|-15640|-15631|-15625|-15454|-15448|-15436|-15435|-15419|-15416|-15408|-15394|-15385|-15377|-15375|-15369' . '|-15363|-15362|-15183|-15180|-15165|-15158|-15153|-15150|-15149|-15144|-15143|-15141|-15140|-15139|-15128' . '|-15121|-15119|-15117|-15110|-15109|-14941|-14937|-14933|-14930|-14929|-14928|-14926|-14922|-14921|-14914' . '|-14908|-14902|-14894|-14889|-14882|-14873|-14871|-14857|-14678|-14674|-14670|-14668|-14663|-14654|-14645' . '|-14630|-14594|-14429|-14407|-14399|-14384|-14379|-14368|-14355|-14353|-14345|-14170|-14159|-14151|-14149' . '|-14145|-14140|-14137|-14135|-14125|-14123|-14122|-14112|-14109|-14099|-14097|-14094|-14092|-14090|-14087' . '|-14083|-13917|-13914|-13910|-13907|-13906|-13905|-13896|-13894|-13878|-13870|-13859|-13847|-13831|-13658' . '|-13611|-13601|-13406|-13404|-13400|-13398|-13395|-13391|-13387|-13383|-13367|-13359|-13356|-13343|-13340' . '|-13329|-13326|-13318|-13147|-13138|-13120|-13107|-13096|-13095|-13091|-13076|-13068|-13063|-13060|-12888' . '|-12875|-12871|-12860|-12858|-12852|-12849|-12838|-12831|-12829|-12812|-12802|-12607|-12597|-12594|-12585' . '|-12556|-12359|-12346|-12320|-12300|-12120|-12099|-12089|-12074|-12067|-12058|-12039|-11867|-11861|-11847' . '|-11831|-11798|-11781|-11604|-11589|-11536|-11358|-11340|-11339|-11324|-11303|-11097|-11077|-11067|-11055' . '|-11052|-11045|-11041|-11038|-11024|-11020|-11019|-11018|-11014|-10838|-10832|-10815|-10800|-10790|-10780' . '|-10764|-10587|-10544|-10533|-10519|-10331|-10329|-10328|-10322|-10315|-10309|-10307|-10296|-10281|-10274' . '|-10270|-10262|-10260|-10256|-10254';
$_TDataKey = explode('|', $_DataKey);
$_TDataValue = explode('|', $_DataValue);
$_Data = PHP_VERSION >= '5.0' ? array_combine($_TDataKey, $_TDataValue) : _Array_Combine($_TDataKey, $_TDataValue);
arsort($_Data);
if ($mcharset != 'gbk' && !function_exists('convert_encoding')) {
include M_ROOT . 'include/charset.fun.php';
}
}
# if($_Code != 'gb2312') $_String = _U2_Utf8_Gb($_String);
$mcharset != 'gbk' && ($_String = convert_encoding($mcharset, 'GB2312', $_String));
$_Res = '';
for ($i = 0; $i < strlen($_String); $i++) {
$_P = ord($_Z = $_String[$i]);
if ($_P > 160) {
$_Q = ord($_String[++$i]);
$_P = $_P * 256 + $_Q - 65536;
if ($_P >= -20319 && $_P <= -10247) {
foreach ($_Data as $k => $v) {
if ($v <= $_P) {
$_Res .= $k;
break;
}
}
}
} else {
$_Res .= $_Z;
}
}
return $_Res;
#preg_replace("/[^a-z0-9]*/", '', $_Res);
}
示例3: exit
<?php
!defined('M_COM') && exit('No Permisson');
if (substr($pptout_url, -1, 1) != '/') {
$pptout_url .= '/';
}
if ($action == 'login') {
include_once M_ROOT . "./include/charset.fun.php";
$memberarr = array('time' => $timestamp, 'username' => convert_encoding($mcharset, $pptout_charset, $username), 'password' => md5(md5($password)), 'email' => !empty($email) ? $email : $cmember['email']);
$auth = passport_encrypt(passport_encode($memberarr), $pptout_key);
$verify = md5($action . $auth . $forward . $pptout_key);
$url = $pptout_url . 'api/passport.php?action=login&auth=' . rawurlencode($auth) . '&forward=' . rawurlencode($forward) . '&verify=' . $verify;
} elseif ($action == 'logout') {
$auth = passport_encrypt(passport_encode(array()), $pptout_key);
$verify = md5($action . $auth . $forward . $pptout_key);
$url = $pptout_url . 'api/passport.php?action=logout&forward=' . rawurlencode($forward) . '&verify=' . $verify;
}
/**
* Passport 加密函数
*
* @param string 等待加密的原字串
* @param string 私有密匙(用于解密和加密)
*
* @return string 原字串经过私有密匙加密后的结果
*/
function passport_encrypt($txt, $key)
{
// 使用随机数发生器产生 0~32000 的值并 MD5()
srand((double) microtime() * 1000000);
$encrypt_key = md5(rand(0, 32000));
// 变量初始化
示例4: GetIndexText
function GetIndexText($okstr, $ilen = -1)
{
global $mcharset, $lan_version;
if ($okstr == '') {
return '';
}
$ws = explode(" ", $okstr);
$okstr = '';
$wks = '';
foreach ($ws as $w) {
$w = trim($w);
//排除小于2的字符
if (strlen($w) < 2) {
continue;
}
//排除数字或日期
if (!preg_match("/[^0-9:-]/", $w)) {
continue;
}
if (strlen($w) == 2 && ord($w[0]) > 0x80) {
continue;
}
if (isset($wks[$w])) {
$wks[$w]++;
} else {
$wks[$w] = 1;
}
}
if (is_array($wks)) {
arsort($wks);
if ($ilen == -1) {
foreach ($wks as $w => $v) {
if ($this->GetRank($w) > 500) {
$okstr .= $w . " ";
}
}
} else {
foreach ($wks as $w => $v) {
if (strlen($okstr) + strlen($w) + 1 < $ilen) {
$okstr .= $w . " ";
} else {
break;
}
}
}
}
if ($mcharset != 'gbk') {
if ($lan_version == 'tc' && $mcharset == 'utf-8') {
$okstr = convert_encoding('gbk', 'big5', $okstr);
$okstr = convert_encoding('big5', $mcharset, $okstr);
} else {
$okstr = convert_encoding('gbk', $mcharset, $okstr);
}
}
return trim($okstr);
}
示例5: login
function login($_username, $_password)
{
if (H::valid_email($_username)) {
// 使用 E-mail 登录
list($uc_uid, $username, $password, $email) = uc_user_login($_username, $_password, 2);
}
if ($this->ucenter_charset != 'utf-8') {
$username = convert_encoding($username, $this->ucenter_charset, 'UTF-8');
}
if (!$uc_uid) {
if ($this->ucenter_charset != 'utf-8') {
list($uc_uid, $username, $password, $email) = uc_user_login(convert_encoding($_username, 'utf-8', $this->ucenter_charset), $_password);
if ($username) {
$username = convert_encoding($username, $this->ucenter_charset, 'UTF-8');
}
} else {
list($uc_uid, $username, $password, $email) = uc_user_login($_username, $_password);
}
}
if ($username) {
$username = htmlspecialchars($username);
}
if ($uc_uid > 0) {
if (!($user_info = $this->get_uc_user_info($uc_uid))) {
if ($site_user_info = $this->model('account')->get_user_info_by_email($email)) {
$this->insert('users_ucenter', array('uid' => $site_user_info['uid'], 'uc_uid' => $uc_uid, 'username' => $username, 'email' => $email));
return false;
}
if ($new_user_id = $this->model('account')->user_register($username, $_password, $email, TRUE)) {
if ($exists_uc_id = $this->is_uc_user($email)) {
$this->update('users_ucenter', array('username' => $username, 'uid' => $new_user_id), 'uc_uid = ' . intval($exists_uc_id));
} else {
$this->insert('users_ucenter', array('uid' => $new_user_id, 'uc_uid' => $uc_uid, 'username' => $username, 'email' => $email));
if (uc_check_avatar($uc_uid, 'big')) {
$avatar = @file_get_contents(UC_API . '/avatar.php?uid=' . $uc_uid . '&size=big');
if ($avatar) {
AWS_APP::upload()->initialize(array('allowed_types' => 'jpg,jpeg,png,gif', 'upload_path' => get_setting('upload_dir') . '/avatar/' . $this->model('account')->get_avatar($new_user_id, '', 1), 'is_image' => TRUE, 'max_size' => get_setting('upload_avatar_size_limit'), 'file_name' => $this->model('account')->get_avatar($new_user_id, '', 2), 'encrypt_name' => FALSE))->do_upload('aws_upload_file', $avatar);
if (!AWS_APP::upload()->get_error()) {
$upload_data = AWS_APP::upload()->data();
if ($upload_data) {
if ($upload_data['is_image'] == 1) {
foreach (AWS_APP::config()->get('image')->avatar_thumbnail as $key => $val) {
$thumb_file[$key] = $upload_data['file_path'] . $this->model('account')->get_avatar($new_user_id, $key, 2);
AWS_APP::image()->initialize(array('quality' => 90, 'source_image' => $upload_data['full_path'], 'new_image' => $thumb_file[$key], 'width' => $val['w'], 'height' => $val['h']))->resize();
}
}
$update_data['avatar_file'] = $this->model('account')->get_avatar($new_user_id, null, 1) . basename($thumb_file['min']);
// 更新主表
$this->model('account')->update_users_fields($update_data, $new_user_id);
if (!$this->model('integral')->fetch_log($new_user_id, 'UPLOAD_AVATAR')) {
$this->model('integral')->process($new_user_id, 'UPLOAD_AVATAR', round(get_setting('integral_system_config_profile') * 0.2), '上传头像');
}
}
}
}
}
}
$user_info = $this->model('account')->get_user_info_by_uid($new_user_id, true, false);
}
} else {
// Update password
$this->model('account')->update_user_password_ingore_oldpassword($_password, $user_info['uid'], $user_info['salt']);
// Update username
if ($user_info['user_name'] != $username) {
if (!$this->model('account')->check_username($username)) {
$this->model('account')->update_user_name($username, $user_info['uid']);
$this->update('users_ucenter', array('username' => htmlspecialchars($username)), 'uc_uid = ' . intval($uc_uid));
}
}
}
}
return $user_info;
}
示例6: check_username_char
public function check_username_char($user_name)
{
if (is_digits($user_name)) {
return AWS_APP::lang()->_t('用户名不能为纯数字');
}
if (strstr($user_name, '-')) {
return AWS_APP::lang()->_t('用户名不能包含 -');
}
$length = strlen(convert_encoding($user_name, 'UTF-8', 'GB2312'));
$length_min = intval(get_setting('username_length_min'));
$length_max = intval(get_setting('username_length_max'));
if ($length < $length_min || $length > $length_max) {
$flag = true;
}
switch (get_setting('username_rule')) {
default:
break;
case 1:
if (!preg_match('/^[\\x{4e00}-\\x{9fa5}_a-zA-Z0-9]+$/u', $user_name) or $flag) {
return AWS_APP::lang()->_t('请输入大于 %s 字节的用户名, 允许汉字、字母与数字', $length_min . ' - ' . $length_max);
}
break;
case 2:
if (!preg_match("/^[a-zA-Z0-9_]+\$/i", $user_name) or $flag) {
return AWS_APP::lang()->_t('请输入 %s 个字母、数字或下划线', $length_min . ' - ' . $length_max);
}
break;
case 3:
if (!preg_match("/^[\\x{4e00}-\\x{9fa5}]+\$/u", $user_name) or $flag) {
return AWS_APP::lang()->_t('请输入 %s 个汉字', ceil($length_min / 2) . ' - ' . floor($length_max / 2));
}
break;
}
return false;
}
示例7: random
if (preg_match("/^1[358]\\d{9}\$/", $mobile)) {
$msgcode = random(6, 1);
$id = ${"msgcode_sp{$msgcode_gate}"};
$pw = ${"msgcode_pw{$msgcode_gate}"};
if (empty($msgcode_mode) || $msgcode_mode == 1 && empty($msgcode_msg) || $msgcode_mode == 2 && (empty($id) || empty($pw) || empty($msgcode_sms))) {
$info = array('time' => -1, 'text' => 'no_msg_gate');
} elseif ($msgcode_mode == 1) {
msetcookie('08cms_msgcode', authcode("{$timestamp}\t{$msgcode}", 'ENCODE'));
$info = array('time' => -1, 'text' => str_replace('%s', $msgcode, $msgcode_msg));
} elseif ($msgcode_mode == 2) {
list($inittime, $initcode) = maddslashes(explode("\t", @authcode($m_cookie['08cms_msgcode'], 'DECODE')), 1);
if ($timestamp - $inittime > 60) {
$msg = str_replace('%s', $msgcode, $msgcode_sms);
if ($mcharset != 'gbk' || $mcharset != 'gb2312') {
include M_ROOT . 'include/charset.fun.php';
$msg = convert_encoding($mcharset, 'gb2312', $msg);
}
$msg = rawurlencode($msg);
$url = $msgcode_gate == 1 ? "http://sms.eshang8.cn/api/?esname={$id}&key=pw&phone={$mobile}&msg={$msg}&smskind=1" : "http://service.winic.org/sys_port/gateway/?id={$id}&pwd={$pw}&to={$mobile}&content={$msg}&time={$timestamp}";
include M_ROOT . 'include/http.cls.php';
$http = new http();
$http->timeout = 60;
$msg = $http->fetchtext($url);
if ($msgcode_gate == 1) {
$msg = $msg === '0';
} else {
$msg = explode("/", $msg);
$msg = $msg[0] === '000';
}
if ($msg) {
msetcookie('08cms_msgcode', authcode("{$timestamp}\t{$msgcode}", 'ENCODE'));
示例8: get_user_info
/**
* 获取当前QQ用户的信息
* @return array
*/
function get_user_info()
{
$uinfo_url = $this->uinfo_url . '?access_token=' . $this->access_token . '&oauth_consumer_key=' . $this->appid . '&openid=' . $this->openid;
$user_info = httpget($uinfo_url, $error);
$user_info = json_decode($user_info, TRUE);
if (empty($user_info) || $user_info['ret'] != 0) {
throw new Exception('Can not get user info.' . $error);
}
//patch for gbk
$user_info['nickname'] = convert_encoding($user_info['nickname']);
$user_info['gender'] = convert_encoding($user_info['gender']);
!session_id() && session_start();
$_SESSION['qq_oauth_figureurl_2'] = $user_info['figureurl_2'];
return $user_info;
}
示例9: mysql_query
}
$sql = "select * from gallerie ORDER BY id_gal DESC";
$result = mysql_query($sql) or die("Error in query: {$query}. " . mysql_error());
$rows = mysql_num_rows($result);
while ($donnees = mysql_fetch_array($result)) {
$img = $donnees["img"];
$titre = $donnees["titre"];
?>
<div class="cont">
<a href="images/<?php
echo $img;
?>
" class="swipebox" title="<?php
$titre = convert_encoding($titre, 'UTF-8');
echo $titre;
?>
"> <img src="images/<?php
echo $img;
?>
" alt="<?php
echo $titre;
?>
"><span class="zoom-icon"></span> </a>
</div>
<?php
}
?>
</div>
示例10: onepage
function onepage($url)
{
global $mcharset, $progress;
$m_http = new http();
$m_http->timeout = $this->gmission['timeout'] ? $this->gmission['timeout'] : 0xffff;
if ($this->gmission['mcookies']) {
$m_http->setCookies($this->gmission['mcookies']);
}
$html = $m_http->fetchtext($url);
unset($m_http);
$html = convert_encoding($this->gmission['mcharset'], $mcharset, $html);
$this->clean_blank($html);
$progress && $progress->pagecount(1);
return $html;
}
示例11: login
function login($_username, $_password)
{
if (H::valid_email($_username)) {
// 使用 E-mail 登录
list($uc_uid, $username, $password, $email) = uc_user_login($_username, $_password, 2);
}
if ($this->ucenter_charset != 'utf-8') {
$username = convert_encoding($username, $this->ucenter_charset, 'UTF-8');
}
if (!$uc_uid) {
if ($this->ucenter_charset != 'utf-8') {
list($uc_uid, $username, $password, $email) = uc_user_login(convert_encoding($_username, 'utf-8', $this->ucenter_charset), $_password);
if ($username) {
$username = convert_encoding($username, $this->ucenter_charset, 'UTF-8');
}
} else {
list($uc_uid, $username, $password, $email) = uc_user_login($_username, $_password);
}
}
if ($username) {
$username = htmlspecialchars($username);
}
if ($uc_uid > 0) {
if ($user_info = $this->get_uc_user_info($uc_uid)) {
// Update password
$this->model('account')->update_user_password_ingore_oldpassword($_password, $user_info['uid'], $user_info['salt']);
// Update username
if ($user_info['user_name'] != $username) {
if (!$this->model('account')->check_username($username)) {
$this->model('account')->update_user_name($username, $user_info['uid']);
$this->update('users_ucenter', array('username' => htmlspecialchars($username)), 'uc_uid = ' . intval($uc_uid));
}
}
} else {
if ($site_user_info = $this->model('account')->get_user_info_by_email($email)) {
$this->insert('users_ucenter', array('uid' => $site_user_info['uid'], 'uc_uid' => $uc_uid, 'username' => $username, 'email' => $email));
return false;
}
if ($new_user_id = $this->model('account')->user_register($username, $_password, $email, TRUE)) {
if ($exists_uc_id = $this->is_uc_user($email)) {
$this->update('users_ucenter', array('username' => $username, 'uid' => $new_user_id), 'uc_uid = ' . intval($exists_uc_id));
} else {
$this->insert('users_ucenter', array('uid' => $new_user_id, 'uc_uid' => $uc_uid, 'username' => $username, 'email' => $email));
}
$user_info = $this->model('account')->get_user_info_by_uid($new_user_id, true, false);
}
}
}
if (uc_check_avatar($uc_uid, 'big')) {
if (!$user_info['avatar_file']) {
$this->model('account')->associate_remote_avatar($user_info['uid'], UC_API . '/avatar.php?uid=' . $uc_uid . '&size=big');
}
} else {
if ($user_info['avatar_file'] and get_setting('ucenter_path')) {
$avatar = get_setting('upload_dir') . '/avatar/' . $this->model('account')->get_avatar($user_info['uid'], '');
$uc_avatar_dir = get_setting('ucenter_path') . '/data/avatar/' . $this->model('account')->get_avatar($uc_uid, '', 1);
if (!file_exists($uc_avatar_dir)) {
make_dir($uc_avatar_dir);
}
foreach (AWS_APP::config()->get('image')->uc_avatar_thumbnail as $key => $val) {
AWS_APP::image()->initialize(array('quality' => 90, 'source_image' => $avatar, 'new_image' => $uc_avatar_dir . $this->model('account')->get_avatar($uc_uid, $key, 2), 'width' => $val['w'], 'height' => $val['h']))->resize();
}
}
}
return $user_info;
}
示例12: download_email
private function download_email($account)
{
$log =& singleton::get(__NAMESPACE__ . '\\log');
$tickets =& singleton::get(__NAMESPACE__ . '\\tickets');
$ticket_notes =& singleton::get(__NAMESPACE__ . '\\ticket_notes');
$users =& singleton::get(__NAMESPACE__ . '\\users');
$storage =& singleton::get(__NAMESPACE__ . '\\storage');
$pop3 = $account['obj'];
$pop3->hostname = $account['hostname'];
// POP 3 server host name
$pop3->port = $account['port'];
// POP 3 server host port
$pop3->tls = $account['tls'];
// Establish secure connections using TLS
$pop3->realm = '';
/* Authentication realm or domain */
$pop3->workstation = '';
/* Workstation for NTLM authentication */
$apop = 0;
/* Use APOP authentication */
$pop3->authentication_mechanism = 'USER';
/* SASL authentication mechanism */
$pop3->debug = 0;
/* Output debug information */
$pop3->html_debug = 0;
/* Debug information is in HTML */
$pop3->join_continuation_header_lines = 1;
/* Concatenate headers split in multiple lines */
if (($error = $pop3->Open()) == '') {
if (($error = $pop3->Login($account['username'], $account['password'], $apop)) == '') {
if (($error = $pop3->Statistics($messages, $size)) == '') {
if ($messages > 0) {
$log_array['event_severity'] = 'notice';
$log_array['event_number'] = E_USER_NOTICE;
$log_array['event_description'] = 'Found "' . (int) $messages . '" messages on POP server "' . safe_output($pop3->hostname) . '" for download';
$log_array['event_file'] = __FILE__;
$log_array['event_file_line'] = __LINE__;
$log_array['event_type'] = 'download_email';
$log_array['event_source'] = 'pop_system';
$log_array['event_version'] = '1';
$log_array['log_backtrace'] = false;
$log->add($log_array);
$pop3->GetConnectionName($connection_name);
for ($index = 1; $index <= $messages; $index++) {
$saved_files = array();
$found_subject = false;
$message_file = 'pop3://' . $connection_name . '/' . $index;
$mime = new \mime_parser_class();
/*
* Set to 0 for not decoding the message bodies
*/
$mime->decode_bodies = 1;
$parameters = array('File' => $message_file);
$success = $mime->Decode($parameters, $email_message);
$email = array();
$email['body'] = '';
$email['html'] = 0;
//get the message id
$email['message_id'] = '';
if (isset($email_message[0]['Headers']['message-id:'])) {
$email['message_id'] = $email_message[0]['Headers']['message-id:'];
}
//check if already downloaded
$import_message = true;
if (!empty($email['message_id'])) {
$count = $this->count_message(array('message_id' => $email['message_id']));
if ($count > 0) {
$import_message = false;
}
$this->add_message(array('message_id' => $email['message_id']));
}
if ($import_message) {
if ($mime->Analyze($email_message[0], $results)) {
//print_r($results);
//exit;
if ($results['Type'] == 'html') {
$email['type'] = 'html';
if ($account['html_enabled'] == 1) {
if (isset($results['Data']) && !empty($results['Data'])) {
$email['html'] = 1;
$email['body'] = convert_encoding($results['Data'], $results['Encoding']);
} else {
$email['body'] = convert_encoding($results['Alternative'][0]['Data'], $results['Encoding']);
}
} else {
if (isset($results['Alternative'][0]['Data']) && !empty($results['Alternative'][0]['Data'])) {
$email['body'] = convert_encoding($results['Alternative'][0]['Data'], $results['Encoding']);
} else {
$data = str_replace('<!DOCTYPE', '<DOCTYPE', $results['Data']);
$data = preg_replace("'<style[^>]*>.*</style>'siU", '', $data);
$data = preg_replace('/</', ' <', $data);
$data = preg_replace('/>/', '> ', $data);
$data = html_entity_decode(strip_tags($data));
$data = preg_replace('/[\\n\\r\\t]/', ' ', $data);
$data = preg_replace('/ /', ' ', $data);
$data = trim($data);
$email['body'] = convert_encoding($data, $results['Encoding']);
}
}
} elseif ($results['Type'] == 'text') {
//.........这里部分代码省略.........
示例13: getPage
function getPage($url, $charset)
{
$charset = strtoupper($charset);
$content = "";
if (!empty($url)) {
if (function_exists('curl_init')) {
$ch = @curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; )');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIE, 'domain=www.baidu.com');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$content = @curl_exec($ch);
curl_close($ch);
} else {
if (ini_get('allow_url_fopen') == 1) {
$content = @file_get_contents($url);
} else {
die('当前环境不支持采集【curl 或 allow_url_fopen】,请检查php.ini配置;');
}
}
$content = convert_encoding($content, "utf-8", $charset);
}
return $content;
}
示例14: replace_include
function replace_include($match)
{
global $mode, $lang, $error, $msg_error;
preg_match_all('/\\s+([a-z_:][a-z0-9_:.-]*)\\s?=\\s?(["\'])(.+?)(?<!\\\\)(?:\\\\\\\\)*\\2/i', $match[1], $attrs, PREG_SET_ORDER);
$resource = null;
$tds = false;
foreach ($attrs as $attr) {
switch ($attr[1]) {
case 'src':
$resource = stripslashes($attr[3]);
break;
case 'tds' && $attr[3] == 'true':
case 'now' && $attr[3] == 'true':
$tds = true;
break;
}
}
if (is_null($resource) || !$tds && $mode != 'send') {
return $match[0];
}
if (substr($resource, 0, 7) == 'http://') {
$result = http_get_contents($resource, $errstr);
if ($result == false) {
$errstr = sprintf($lang['Message']['Error_load_url'], htmlspecialchars($resource), $errstr);
}
} else {
if ($resource[0] != '/') {
$resource = WA_ROOTDIR . '/' . $resource;
}
if (is_readable($resource)) {
$fp = fopen($resource, 'r');
$data = fread($fp, filesize($resource));
fclose($fp);
$result = array('data' => $data, 'charset' => '');
} else {
$result = false;
$errstr = sprintf($lang['Message']['File_not_exists'], htmlspecialchars($resource));
}
}
if ($result == false) {
$error = true;
$msg_error[] = $errstr;
return $match[0];
} else {
return convert_encoding($result['data'], $result['charset']);
}
}
示例15: exit
<?php
!defined('M_COM') && exit('No Permisson');
$userdb = array();
if (strpos($pptout_url, ',') !== FALSE) {
$clienturl = explode(',', $pptout_url);
$jumpurl = array_shift($clienturl);
$userdb['url'] = implode(',', $clienturl);
} else {
$jumpurl = $pptout_url;
}
include_once M_ROOT . "./include/charset.fun.php";
$userdb['username'] = convert_encoding($mcharset, $pptout_charset, !empty($username) ? $username : $cmember['mname']);
$userdb['password'] = !empty($password) ? md5($password) : $cmember['password'];
$userdb['email'] = !empty($email) ? $email : $cmember['email'];
$userdb['time'] = $timestamp;
$userdb_encode = '';
foreach ($userdb as $key => $val) {
$userdb_encode .= $userdb_encode ? "&{$key}={$val}" : "{$key}={$val}";
}
$db_hash = $pptout_key;
$userdb_encode = str_replace('=', '', StrCode($userdb_encode));
if (substr($jumpurl, -1, 1) != '/') {
$jumpurl .= '/';
}
if ($action == 'login') {
$verify = md5("login{$userdb_encode}{$forward}{$pptout_key}");
$url = $jumpurl . "passport_client.php?action=login&userdb=" . rawurlencode($userdb_encode) . "&forward=" . rawurlencode($forward) . "&verify=" . rawurlencode($verify);
} elseif ($action == 'logout') {
$verify = md5("quit{$userdb_encode}{$forward}{$pptout_key}");
$url = $jumpurl . "passport_client.php?action=quit&userdb=" . rawurlencode($userdb_encode) . "&forward=" . rawurlencode($forward) . "&verify=" . rawurlencode($verify);