Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
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);
}
Ejemplo n.º 3
0
<?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));
    // 变量初始化
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 6
0
 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;
 }
Ejemplo n.º 7
0
 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'));
Ejemplo n.º 8
0
 /**
  * 获取当前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;
 }
Ejemplo n.º 9
0
}
$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>
Ejemplo n.º 10
0
 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;
 }
Ejemplo n.º 11
0
 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;
 }
 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') {
                                     $email['type'] = 'text';
                                     if (isset($results['Data']) && !empty($results['Data'])) {
                                         $email['body'] = convert_encoding($results['Data'], $results['Encoding']);
                                     }
                                 }
                                 //subject
                                 if (isset($results['Subject']) && !empty($results['Subject'])) {
                                     if (isset($results['Encoding'])) {
                                         $email['subject'] = convert_encoding($results['Subject'], $results['Encoding']);
                                     } else {
                                         $email['subject'] = convert_encoding($results['Subject']);
                                     }
                                     $found_subject = TRUE;
                                 }
                                 //save attachments
                                 if ($account['download_files'] == 1) {
                                     //there are 3 possible places where the file attachments could be
                                     if (isset($results['Attachments']) && is_array($results['Attachments'])) {
                                         foreach ($results['Attachments'] as $possible_file) {
                                             if (isset($possible_file['Type'])) {
                                                 if (!empty($possible_file['FileName'])) {
                                                     $save_array['file']['name'] = $possible_file['FileName'];
                                                     $save_array['file']['data'] = $possible_file['Data'];
                                                     $save_array['name'] = $possible_file['FileName'];
                                                     $saved_files[] = $storage->save_data($save_array);
                                                 }
                                             }
                                         }
                                     }
                                     if (isset($results['Data'])) {
                                         if (!empty($results['FileName'])) {
                                             $save_array['file']['name'] = $results['FileName'];
                                             $save_array['file']['data'] = $results['Data'];
                                             $save_array['name'] = $results['FileName'];
                                             $saved_files[] = $storage->save_data($save_array);
                                         }
                                     }
                                     if (isset($results['Related']) && is_array($results['Related'])) {
                                         foreach ($results['Related'] as $possible_file2) {
                                             if (isset($possible_file2['Type'])) {
                                                 if (!empty($possible_file2['FileName'])) {
                                                     $save_array['file']['name'] = $possible_file2['FileName'];
                                                     $save_array['file']['data'] = $possible_file2['Data'];
                                                     $save_array['name'] = $possible_file2['FileName'];
                                                     $saved_files[] = $storage->save_data($save_array);
                                                 }
                                             }
                                         }
                                     }
                                 }
                                 unset($results);
                             }
                             $email['from_address'] = $email_message[0]['ExtractedAddresses']['from:'][0]['address'];
                             $email['from_name'] = $email_message[0]['ExtractedAddresses']['from:'][0]['name'];
                             $email['to_address'] = $email_message[0]['Headers']['to:'];
                             if (!$found_subject) {
                                 $email['subject'] = $email_message[0]['Headers']['subject:'];
                             }
                             $email['date'] = $email_message[0]['Headers']['date:'];
                             if (!empty($email['from_address'])) {
                                 $clients = $users->get(array('email' => $email['from_address'], 'limit' => 1));
                             } else {
                                 $clients = NULL;
                             }
                             $new_ticket = true;
                             //existing ticket
                             if (strpos($email['body'], '[TID:') !== false) {
                                 $temp_id_array = explode('[TID:', $email['body']);
                                 $temp_id_array2 = explode(']', $temp_id_array[1]);
                                 $tid = $temp_id_array2[0];
                                 if (strpos($tid, '-') !== false) {
                                     $t_array = explode('-', $tid);
                                     $ticket_id = (int) $t_array[1];
                                     $ticket_key = $t_array[0];
                                     if ($ticket_id != 0) {
                                         //now we can check for the actual ticket
                                         $ticket_result = $tickets->get(array('id' => $ticket_id));
                                         if (!empty($ticket_result)) {
                                             $ticket = $ticket_result[0];
                                             if ($ticket['key'] == $ticket_key) {
                                                 $ticket_note['date_added'] = datetime();
                                                 $ticket_note['description'] = $email['body'];
                                                 if (count($clients) == 1) {
                                                     $ticket_note['user_id'] = $clients[0]['id'];
                                                 }
                                                 $ticket_note['html'] = (int) $email['html'];
                                                 $ticket_note['ticket_id'] = $ticket['id'];
                                                 $ticket_notes->add($ticket_note);
                                                 $update_ticket['state_id'] = 1;
                                                 $update_ticket['date_state_changed'] = datetime();
                                                 $update_ticket['id'] = $ticket_id;
                                                 $tickets->edit($update_ticket);
                                                 $new_ticket = false;
                                                 //attach files to ticket
                                                 if ($account['download_files'] == 1) {
                                                     if (!empty($saved_files)) {
                                                         foreach ($saved_files as $file_id) {
                                                             if ($file_id !== false) {
                                                                 $storage->add_file_to_ticket(array('file_id' => $file_id, 'ticket_id' => $ticket['id']));
                                                             }
                                                         }
                                                     }
                                                 }
                                                 unset($ticket_note);
                                             }
                                         }
                                     }
                                 }
                             }
                             //adds a new ticket if anything else fails
                             if ($new_ticket) {
                                 //new ticket
                                 $array['subject'] = $email['subject'];
                                 $array['priority_id'] = $account['priority_id'];
                                 $array['description'] = $email['body'];
                                 $array['date_added'] = datetime();
                                 $array['department_id'] = $account['department_id'];
                                 $array['ticket_state_id'] = 1;
                                 if (count($clients) == 1) {
                                     $array['user_id'] = $clients[0]['id'];
                                 }
                                 $array['email'] = $email['from_address'];
                                 $array['name'] = $email['from_name'];
                                 $array['html'] = (int) $email['html'];
                                 $array['pop_account_id'] = (int) $account['id'];
                                 //print_r($array);
                                 $id = $tickets->add($array);
                                 //attach files to ticket
                                 if ($account['download_files'] == 1) {
                                     if (!empty($saved_files)) {
                                         foreach ($saved_files as $file_id) {
                                             if ($file_id !== false) {
                                                 $storage->add_file_to_ticket(array('file_id' => $file_id, 'ticket_id' => $id));
                                             }
                                         }
                                     }
                                 }
                                 unset($array);
                             }
                             if (!$account['leave_messages']) {
                                 //delete email from pop3 server if it has been added to the database (won't delete from gmail, but will stop it being downloaded via pop3 again)
                                 $pop3->DeleteMessage($index);
                             }
                         }
                     }
                 }
             } else {
                 //unable to retrieve mailbox statistics
             }
         } else {
             $log_array['event_severity'] = 'warning';
             $log_array['event_number'] = E_USER_WARNING;
             $log_array['event_description'] = 'Authentication to POP server "' . safe_output($pop3->hostname) . '" failed';
             $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);
         }
     } else {
         $log_array['event_severity'] = 'warning';
         $log_array['event_number'] = E_USER_WARNING;
         $log_array['event_description'] = 'Unable to connect to POP server "' . safe_output($pop3->hostname) . '", Error "' . safe_output($error) . '"';
         $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->Close();
 }
Ejemplo n.º 13
0
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;
}
Ejemplo n.º 14
0
 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']);
     }
 }
Ejemplo n.º 15
0
<?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);
Ejemplo n.º 16
0
 if (is_dir($f)) {
     $f = str_replace($path . "/", "", $f);
     if (strpos($filters, "," . $f . ",") <= 0) {
         $num_path++;
         $colarr = array('name', 'path');
         $valarr = array($f, $path . "/" . $f);
         for ($i = 0; $i < count($colarr); $i++) {
             $plt->set_var($colarr[$i], $valarr[$i]);
         }
         $plt->parse('rows_' . $rn1, 'list_' . $rn1, true);
     }
 } elseif (is_file($f)) {
     $fs = filesize($f);
     $fsize = round($fs / 1024, 2);
     $filetime = getColorDay(filemtime($f));
     $f = convert_encoding($f, "UTF-8", "GB2312");
     $f = str_replace($path . "/", "", $f);
     $flag = getTemplateFlag($f);
     $f1 = str_replace('label_', '', $f);
     $mark = '内嵌标签:{maccms:load ' . $f1 . '}';
     $status = false;
     if (substring($f, 6) == "label_") {
         if ($label == 'show') {
             $status = true;
         }
     } else {
         $mark = '';
         if ($label != 'show') {
             $status = true;
         }
     }
Ejemplo n.º 17
0
<br>
<div style="width:80%;">
<p style="color:black; font-weight:bold; font-size:15px; " >
<?php 
$situation = convert_encoding($situation, 'UTF-8');
echo $situation;
?>
</p>
</div><br>
<br>
<p style="color:#BA3018; font-weight:bold;font-size:23px;">CONSISTANCE</p>
<br>
<div style="width:80%;">
<p style="color:black; font-weight:bold; font-size:15px; " >
<?php 
$consistance = convert_encoding($consistance, 'UTF-8');
echo $consistance;
?>
</p>
</div>
<br>
	<br><br><p style="color:#BA3018; font-weight:bold; font-size:23px;">LES PLANS DE PROJET</p>
<br><br><br>
<?php 
$sqlP = "select * from plan where id_projet='{$x}' ";
$resultP = mysql_query($sqlP) or die("Error in query: {$query}. " . mysql_error());
while ($donneesP = mysql_fetch_array($resultP)) {
    $plan = $donneesP["plan"];
    $titrex = $donneesP["titre"];
    ?>
				 
Ejemplo n.º 18
0
 /**
  * 将 XML 转换为输出数据
  *
  * @param	string
  * @return	@e string
  */
 protected function _xml_to_output($text)
 {
     /* Unconvert cdata */
     $text = $this->_xml_unconvert_safe_cdata($text);
     /* Using UTF-8 */
     if ($this->_xml_char_set == 'utf-8') {
         return $text;
     } else {
         if ($this->_xml_char_set == 'iso-8859-1') {
             return utf8_decode($text);
         } else {
             return convert_encoding($text, 'utf-8', $this->_xml_char_set);
         }
     }
 }
Ejemplo n.º 19
0
if ($_GET['action'] == 'login') {
    $userinfos = $ckinfos = array();
    if ($pptout_file == '08cms') {
        parse_str(passport_decrypt($_GET['auth'], $pptin_key), $datas);
        foreach ($datas as $k => $v) {
            if (in_array($k, array('mname', 'password', 'email'))) {
                $userinfos[$k] = addslashes($v);
            } elseif (in_array($k, array('cookietime', 'time'))) {
                $ckinfos[$k] = $v;
            }
        }
    } elseif ($pptout_file == 'phpwind') {
        include M_ROOT . "include/charset.fun.php";
        $db_hash = $pptin_key;
        parse_str(StrCode($_GET['userdb'], 'DECODE'), $userdb);
        $userinfos['mname'] = addslashes(convert_encoding($pptout_charset, $mcharset, $userdb['username']));
        $userinfos['password'] = md5($userdb['password']);
        $userinfos['email'] = addslashes($userdb['email']);
        $ckinfos['time'] = $userdb['time'];
    }
    $userinfos['mname'] = preg_replace("/(c:\\con\\con\$|[%,\\*\"\\s\t\\<\\>\\&])/i", "", $userinfos['mname']);
    if (strlen($userinfos['mname']) > 15) {
        $userinfos['mname'] = substr($userinfos['mname'], 0, 15);
    }
    if (empty($ckinfos['time']) || empty($userinfos['mname']) || empty($userinfos['password'])) {
        empty($_GET['forward']) || header("Location: {$_GET['forward']}");
        exit('member data missing!');
    } elseif ($timestamp - $ckinfos['time'] > $pptin_expire) {
        empty($_GET['forward']) || header("Location: {$_GET['forward']}");
        exit('member data expired!');
    }
Ejemplo n.º 20
0
 public function send($address, $title, $body, $from_name = null, $to_name = null, $server = 'master')
 {
     if ($this->transport) {
         $transport_error = $this->transport_error;
         $transport = $this->transport;
         $mail_config = $this->master_config;
     } else {
         switch ($server) {
             case 'master':
                 $transport_error = $this->master_transport_error;
                 $mail_config = $this->master_config;
                 $transport = $this->master_transport;
                 break;
             case 'slave':
                 $transport_error = $this->slave_transport_error;
                 $mail_config = $this->slave_config;
                 $transport = $this->slave_transport;
                 break;
         }
     }
     if ($transport_error) {
         return $transport_error;
     }
     if (strtoupper($mail_config['charset']) != 'UTF-8') {
         $from_name = convert_encoding($from_name, 'UTF-8', $mail_config['charset']);
         $to_name = convert_encoding($to_name, 'UTF-8', $mail_config['charset']);
         $title = convert_encoding($title, 'UTF-8', $mail_config['charset']);
         $body = convert_encoding($body, 'UTF-8', $mail_config['charset']);
     }
     if (defined('IN_SAE')) {
         $this->sae_option['from'] = get_setting('from_email');
         $this->sae_option['to'] = $address;
         $this->sae_option['subject'] = $title;
         $this->sae_option['content_type'] = 'HTML';
         $this->sae_option['content'] = $body;
         $this->transport->setOpt($this->sae_option);
         if (!$this->transport->send()) {
             return $this->transport->errmsg();
         }
     } else {
         try {
             $zend_mail = new Zend_Mail($mail_config['charset']);
             $zend_mail->setBodyHtml($body);
             $zend_mail->setFrom(get_setting('from_email'), $from_name);
             $zend_mail->addTo($address, $to_name);
             $zend_mail->setSubject($title);
             $zend_mail->send($transport);
         } catch (Exception $e) {
             return $e->getMessage();
         }
     }
 }
Ejemplo n.º 21
0
 }
 echo "<font color=red>" . $d . " >> 共&nbsp;" . $fcount . " 个文件,开始位置" . ($s + 1) . ",已累计清理" . $e . "个无效图片 </font> <br>";
 $i = 0;
 $endnum = $s + 29;
 $rc = false;
 if ($fcount > 0) {
     foreach ($farr as $single) {
         if ($i >= $s) {
             if ($s > $endnum) {
                 $rc = true;
                 echo "目录图片过多...";
                 jump('?m=extend-picchkfile-num-' . $num . '-s-' . $s . '-e-' . $e, 3);
                 break;
             }
             $fsingle = $single;
             $single = convert_encoding($single, "UTF-8", "GB2312");
             $fname = str_replace("../upload/", "upload/", $single);
             $sql = "select count(*) from {pre}vod where d_pic='{$fname}'";
             $cc = $db->getOne($sql);
             if ($cc == 0) {
                 $e++;
                 unlink($fsingle);
                 echo "" . $fname . "<font color=red>无效</font><br/>";
             } else {
                 echo "" . $fname . "<font color=green>有效</font><br/>";
             }
             $s++;
         }
         $i++;
         ob_flush();
         flush();
Ejemplo n.º 22
0
 public function encode_search_code($string)
 {
     if (is_array($string)) {
         $string = implode(' ', $string);
     }
     $string = convert_encoding($string, 'UTF-8', 'UTF-16');
     for ($i = 0; $i < strlen($string); $i++, $i++) {
         $code = ord($string[$i]) * 256 + ord($string[$i + 1]);
         if ($code == 32) {
             $output .= ' ';
         } else {
             if ($code < 128) {
                 $output .= chr($code);
             } else {
                 if ($code != 65279) {
                     $output .= $code;
                 }
             }
         }
     }
     return htmlspecialchars($output);
 }
Ejemplo n.º 23
0
function convert_file($scode, $tcode, $sfile = '')
{
    //gbk,big5,utf-8
    if (!$sfile || !is_file($sfile)) {
        return;
    }
    if (empty($scode) || empty($tcode) || $scode == $tcode) {
        return;
    }
    $str = @file2str($sfile);
    $str && ($str = convert_encoding($scode, $tcode, $str));
    str2file($str, $sfile);
}
Ejemplo n.º 24
0
/**
 * 兼容性转码 (数组)
 *
 * 系统转换编码调用此函数, 会自动根据当前环境采用 iconv 或 MB String 处理, 支持多维数组转码
 *
 * @param  array
 * @param  string
 * @param  string
 * @return array
 */
function convert_encoding_array($data, $from_encoding = 'GBK', $target_encoding = 'UTF-8')
{
    return eval('return ' . convert_encoding(var_export($data, true) . ';', $from_encoding, $target_encoding));
}
Ejemplo n.º 25
0
    echo $img;
    ?>
" class="swipebox" title="Image Title"> <img src="admin/afiche/<?php 
    echo $img;
    ?>
" alt=""><span class="zoom-icon"></span> </a>
					</div> 
					  <div class="list-box">
                          	<h5><?php 
    $titre = convert_encoding($titre, 'UTF-8');
    echo $titre;
    ?>
</h5>
                	<div style="width:200px; height:150;">
							<p class="txt2"><?php 
    $des = convert_encoding($des, 'UTF-8');
    echo $des;
    ?>
</div>
                       </div>
					   <div class="more">
                         <a href="aff_projet.php?d=<?php 
    echo $id_projet;
    ?>
 " class="btn btn-primary btn1">Voir plus</a>
                       </div>
					  
				</div>
				<?php 
}
?>
Ejemplo n.º 26
0
 /**
  * 系统不开启 iconv 模块时, 自建 iconv(), 使用 MB String 库处理
  *
  * @param  string
  * @param  string
  * @param  string
  * @return string
  */
 function iconv($from_encoding = 'GBK', $target_encoding = 'UTF-8', $string)
 {
     return convert_encoding($string, $from_encoding, $target_encoding);
 }
Ejemplo n.º 27
0
    echo '</td><td align="right">';
    if ($numrows > $number_of_items) {
        echo '<a href="javascript:void(0)" onclick="showGlossary(\'' . $current_glossary . '\',\'' . $next . '\')"><img src="../img/media_playback_start.png"></a>';
    } else {
        //	echo '<img src="../img/media_playback_start.png">';
    }
    echo '</div>';
} elseif (isset($_GET['action']) && $_GET['action'] == 'showterm') {
    $id = $_GET['q'];
    $t_glossary = Database::get_course_table(TABLE_GLOSSARY);
    $t_item_propery = Database::get_course_table(TABLE_ITEM_PROPERTY);
    $query = "SELECT \tg.glossary_id \t\tAS glossary_id,\n\t\t\t\t\tg.name \t\t\t\tAS glossary_title,\n\t\t\t\t\tg.description \t\tAS glossary_comment,\n\t\t\t\t\tg.display_order\t\tAS glossary_display_order\n\t\t\t   FROM {$t_glossary} g, {$t_item_propery} ip\n\t\t\t   WHERE g.glossary_id = ip.ref\n\t\t\t   AND tool = '" . TOOL_GLOSSARY . "'\n\t\t\t   AND g.glossary_id = '" . Database::escape_string($id) . "' ";
    $res = api_sql_query($query, __FILE__, __LINE__);
    while ($data = Database::fetch_object($res)) {
        $glossary_name = convert_encoding($data->glossary_title);
        $glossary_description = convert_encoding($data->glossary_comment);
    }
    // Wrapper for add edit form + image map
    echo '<div id="wrapper_glossary_form">';
    //To show Add and Edit Definition form
    echo '<div id="glossary_form">';
    echo '<div align="center" class="quiz_content_actions">' . $glossary_name . '</div>';
    echo '<div align="center" class="quiz_content_actions glossary_description_height" style="overflow:auto;text-align:left;">' . $glossary_description . '</div>';
    if (api_is_allowed_to_edit(null, true)) {
        echo '<div align="right" class="quiz_content_actions" style="border:none;"><a href="index.php?' . api_get_cidReq() . '&action=editterm&glossary_id=' . $id . '">' . Display::return_icon('pixel.gif', get_lang('Edit'), array('class' => 'actionplaceholdericon actionedit')) . '&nbsp;&nbsp;<a onclick="return confirmation(\'' . $glossary_name . '\');" href="index.php?action=delete_glossary&glossary_id=' . $id . '">' . Display::return_icon('pixel.gif', get_lang('Delete'), array('class' => 'actionplaceholdericon actiondelete')) . '</a></div>';
    }
    // Close add/edit form
    echo '</div>';
    // Add image map
    echo '<div id="glossary_image_map">';
    echo '<a href="index.php?' . api_get_cidReq() . '"><img class="abs" src="../img/imagemap90.png" style="margin:30px 30px 0 0; right:0; top:0;"></a>';