/** * 获得好友列表 */ 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; } }
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']))); } }
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; }
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); } }
/** * 根据用户名密码获得 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; }
/** * 获得好友列表 */ 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; } }
} 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";
$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++; } } } //更新缓存
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); }
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); }
$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') {
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); } } }
$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'];
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');
/** * 编码转换 * * @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); } } }
S::gp(array('data')); $data = pwHtmlspecialchars_decode(stripslashes($data)); require_once R_P . 'lib/utility/json.class.php'; $json = new Services_JSON(true); $data = $json->decode($data); $returnArray = array(); foreach ($data as $value) { switch ($value[1]) { case 'regname': $return = $registerCheckService->checkUsername($value[2]); break; case 'regemail': $return = $registerCheckService->checkEmail($value[2]); break; case 'reggdcode': $value[2] = pwConvert(rawurldecode($value[2]), $db_charset, 'utf-8'); $return = $registerCheckService->checkGdcode($value[2]); break; case 'qanswer': list($question, $answer) = explode('|', $value[2]); $return = $registerCheckService->checkQanswer($answer, $question); break; case 'invcode': $return = $registerCheckService->checkInvcode($value[2]); break; case 'customerfield': list($fieldname, $v) = explode('|', $value[2]); $v = S::escapeChar(urldecode($v)); $return = $registerCheckService->checkCustomerField($fieldname, $v); break; }
function run($request) { $request = $this->strips($request); if (isset($request['type']) && $request['type'] == 'uc') { $this->type = 'uc'; $this->apikey = PW_KEY; } else { $this->type = 'app'; $this->apikey = PW_APIID; $this->siteappkey = PW_KEY; } 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'])) { require_once R_P . 'api/pw_api/class_json.php'; $json = new Services_JSON(true); $params['appthreads'] = $json->decode(@gzuncompress($params['appthreads'])); } if ($params && isset($request['charset'])) { $params = pwConvert($params, $this->charset, $request['charset']); } return $this->callback($mode, $method, $params); }
function convertCharset($inCharset, $outCharset, $data) { if (is_array($data)) { $newData = array(); foreach ($data as $key => $value) { $newKey = PlatformApiClientUtility::convertCharset($inCharset, $outCharset, $key); $newValue = PlatformApiClientUtility::convertCharset($inCharset, $outCharset, $value); $newData[$newKey] = $newValue; } return $newData; } return pwConvert($data, $outCharset, $inCharset); }
<?php !defined('P_W') && exit('Forbidden'); S::gp(array('keyword')); L::loadClass('adminsearch', 'site', false); $keyword = pwConvert(urldecode($keyword), $db_charset, 'utf8'); $searchpurview = new AdminSearch($keyword); $result = $searchpurview->search(); include PrintEot('search'); exit;
/** * 数据交互 * @param int $tid 帖子id * @param int $actmid 活动二级分类id * @return '' */ function pushActivityToAppCenter($tid, $actmid) { global $db_siteid, $db_siteownerid, $db_sitehash, $db_bbsurl, $db_bbsname, $db_charset; $defaultValueTableName = getActivityValueTableNameByActmid(); $this->db->update("UPDATE {$defaultValueTableName} SET pushtime=" . S::sqlEscape($this->timestamp) . " WHERE tid=" . S::sqlEscape($tid)); $i = $payMemberNums = $orderMemberNums = $payMemberCosts = $orderMemberCosts = $payRefundCouts = 0; $query = $this->db->query("SELECT am.tid,am.fupid,am.isrefund,am.ifpay,am.totalcash,am.signupnum,t.subject,t.authorid,t.author,t.postdate FROM pw_activitymembers am LEFT JOIN pw_threads t ON am.tid=t.tid WHERE am.tid=" . S::sqlEscape($tid)); while ($rt = $this->db->fetch_array($query)) { if ($rt['ifpay'] != 3 && $rt['fupid'] == 0) { //费用关闭的不算 $orderMemberNums += $rt['signupnum']; //已报名人数 } if ($rt['ifpay'] != 3 && $rt['isrefund'] == 0) { //费用关闭的不算 $orderMemberCosts += $rt['totalcash']; //涉及费用 } if ($rt['ifpay'] != 0 && $rt['ifpay'] != 3 && $rt['fupid'] == 0) { //自己支付1、确认支付2、费用退完4 $payMemberNums += $rt['signupnum']; //已经付款的人数 } if ($rt['ifpay'] != 0 && $rt['ifpay'] != 3 && $rt['isrefund'] == 0) { //自己支付1、确认支付2、费用退完4 $payMemberTempCosts += $rt['totalcash']; //已支付费用 } if ($rt['isrefund'] == 1) { $payRefundCouts += $rt['totalcash']; //退款费用 } if ($i == 0) { $tid = $rt['tid']; $subject = $rt['subject']; $authorid = $rt['authorid']; $author = $rt['author']; $postdate = $rt['postdate']; } } if ($orderMemberNums) { //有人报名才更新 $author = pwConvert($author, 'gbk', $db_charset); $subject = pwConvert($subject, 'gbk', $db_charset); $acttype = pwConvert($this->activitymodeldb[$actmid]['name'], 'gbk', $db_charset); $db_bbsname = pwConvert($db_bbsname, 'gbk', $db_charset); $partner = md5($db_siteid . $db_siteownerid); $payMemberCosts = $payMemberTempCosts - $payRefundCouts; //已支付费用 $para = array('tid' => $tid, 'subject' => $subject, 'authorid' => $authorid, 'author' => $author, 'postdate' => $postdate, 'acttype' => $acttype, 'ordermembernums' => $orderMemberNums, 'ordermembercosts' => $orderMemberCosts, 'paymembernums' => $payMemberNums, 'paymembercosts' => $payMemberCosts, 'sitehash' => $db_sitehash, 'bbsurl' => $db_bbsurl, 'bbsname' => $db_bbsname); ksort($para); reset($para); $arg = ''; foreach ($para as $key => $value) { $arg .= "{$key}={$value}&"; $url .= "{$key}=" . urlencode($value) . "&"; } $sign = md5(substr($arg, 0, -1) . $partner); $url .= 'sign=' . $sign; require_once R_P . 'require/posthost.php'; PostHost("http://stats.phpwind.com/api.php?m=app&job=alipayaa", $url, "POST"); } }
} // 站点是否绑定该类型 $weiboSiteBindService = L::loadClass('WeiboSiteBindService', 'sns/weibotoplatform/service'); if (!$weiboSiteBindService->isBind($type)) { return; } $db_bbsurl .= "/"; if ($tid) { // 取帖子内容 //$threads = L::loadClass('Threads', 'forum'); //$read = $threads->getByThreadId($tid); $read = $db->get_one("SELECT t.* ,tm.* FROM pw_threads t LEFT JOIN " . S::sqlMetadata(GetTtable($tid)) . " tm ON t.tid=tm.tid WHERE t.tid=" . S::sqlEscape($tid)); if (!empty($read)) { $sinaWeiboContentTranslator = L::loadClass('SinaWeiboContentTranslator', 'sns/weibotoplatform/'); $shareContent = $sinaWeiboContentTranslator->translate('article', array('content' => preg_replace(array('/( ){1,}/', '/( ){1,}/'), array(' ', ' '), substrs(stripWindCode(str_replace("\n", " ", strip_tags($read['content']))), 100)), 'objectid' => $tid), array('title' => $read['subject'])); $title = urlencode(pwConvert($shareContent, 'UTF8', $db_charset)); $query = $db->query("SELECT aid,attachurl,pid,type,ifthumb FROM pw_attachs WHERE pid=0 AND tid=" . S::sqlEscape($tid)); $attachImg = ''; while ($rt = $db->fetch_array($query)) { if ($rt['type'] != 'img') { continue; } $tmpUrl = geturl($rt['attachurl'], $rt['ifthumb']); if (is_array($tmpUrl)) { $attachImg[] = false !== strpos($tmpUrl[0], 'http://') ? $tmpUrl[0] : $db_bbsurl . $tmpUrl[0]; } } $photoCount = count($attachImg); } } // 用户是否已经绑定了该类型的帐号 没有则引导
function pwArrayConvert($array, $to_encoding, $from_encoding, $ifmb = true) { if (is_array($array)) { foreach ($array as $key => $value) { $array[$key] = pwArrayConvert($value, $to_encoding, $from_encoding, $ifmb); } } else { $array = pwConvert($array, $to_encoding, $from_encoding, $ifmb); } return $array; }
<?php !defined('P_W') && exit('Forbidden'); /** * 门户前台管理入口 * @author liuhui @2010-3-10 */ S::gp(array("invokename", "channelid", "action", "selid")); $invokename = pwConvert(urldecode($invokename), $db_charset, 'utf8'); $levelService = L::loadclass("AreaLevel", 'area'); if (empty($action)) { /*门户管理操作*/ $portalPageService = L::loadClass('portalpageservice', 'area'); $channelid = $portalPageService->getSignForManage($channelid); $invokeService = L::loadClass('invokeservice', 'area'); $invokeInfo = $invokeService->getInvokeByName($invokename); if (!$invokeInfo) { echo $levelService->language("area_no_invoke"); } $invokename = trim(strip_tags($invokename)); $level = $levelService->getAreaLevel($winduid, $channelid, $invokename); if ($level) { //获取频道名称 list($title, $baseUrl) = array("模块内容管理-" . $invokeInfo['title'], "mode.php?m=area&q=manage&invokename=" . urlencode($invokename) . "&channelid=" . $channelid); require_once areaLoadFrontView('area_dialog'); } else { echo $levelService->language("area_no_level"); } ajax_footer(); } elseif ($action == "pushto") { /*内容推送/推荐操作*/
$friends[$key]['attentionEach'] = 1; } } $friendsAllUids = getFriendsIdArr($winduid); $pages = numofpage($count, $page, ceil($count / $db_perpage), "{$thisbase}ftid={$ftype}&"); } elseif ($type == 'find') { S::gp(array('step', 'according')); $db_perpage = 12; $according = $according ? $according : 'user'; ${$according . 'checked'} = 'selected="selected"'; //所有好友 $friendsAllUids = getFriendsIdArr($winduid); if ($step == 2) { S::gp(array('f_keyword', 'decode')); !isset($f_keyword) && Showmsg('pse_input_keyword'); $decode && ($f_keyword = pwConvert($f_keyword, $db_charset, 'utf8')); if ($according && !in_array($according, array('user', 'uid', 'email', 'tags'))) { showMsg("抱歉,搜索类型不存在"); } $f_keyword = strip_tags($f_keyword); $count = 0; $members = $myAttentionUids = array(); $searchURL = "u.php?a=friend&type=find"; switch ($according) { case "user": $searcherService = L::loadclass('searcher', 'search'); /* @var $searcherService PW_searcher */ $uids = $memberdata = $attentionData = array(); list($count, $users) = $searcherService->searchUsers($f_keyword, $page, $db_perpage); $users = $users ? $users : array(); foreach ($users as $user) {
<?php header('Content-type: text/html;charset=' . $db_charset); !defined('P_W') && exit('Forbidden'); define('AJAX', 1); $output = array(); S::gp(array('key'), 'GP'); PostCheck(); $key = pwConvert(urldecode($key), $db_charset, 'utf8'); if (!$winduid || !$key || strlen($key) > 15) { $output['status'] = 0; echo pwJsonEncode($output); exit; } $attentionService = L::loadClass('Attention', 'friend'); /* @var $attentionService PW_Attention */ $friends = $attentionService->getUidsInFollowList($winduid, 1, 500); if (S::isArray($friends)) { $userService = L::loadClass('userservice', 'user'); $usernames = $userService->getUserNamesByUserIds($friends); foreach ($usernames as $k => $v) { if (strpos($v, $key) !== 0) { unset($usernames[$k]); } } $output['status'] = 1; foreach ((array) $usernames as $k => $v) { $output['users'][] = array('uid' => $k, 'uname' => $v); } } else { $output['status'] = 0;
function update($uploaddb) { global $timestamp, $db_charset; foreach ($uploaddb as $value) { $value['name'] = pwConvert($value['name'], $db_charset, 'utf-8'); $this->db->update("INSERT INTO pw_actattachs SET " . S::sqlSingle(array('uid' => $this->uid, 'actid' => 0, 'hits' => 0, 'name' => $value['name'], 'type' => $value['type'], 'size' => $value['size'], 'attachurl' => $value['fileuploadurl'], 'uploadtime' => $timestamp, 'descrip' => $value['descrip'], 'ifthumb' => $value['ifthumb']))); $aid = $this->db->insert_id(); $value['aid'] = $aid; $this->attachs[$aid] = $value; } }
function showSurvey($itemdb = array()) { //调查问卷 global $db_charset; $survey_cache = "<?php\r\n"; if (!empty($itemdb) && is_array($itemdb)) { $survey_cache .= "\$db_survey='1';\r\n"; } else { $survey_cache .= "\$db_survey='0';\r\n"; } foreach ($itemdb as $key => $item) { $item['url'] = rawurldecode($item['url']); $itemd[$key] = $item; } if (is_array($itemd)) { $survey_cache .= "\$survey_cache=" . pw_var_export($itemd); $survey_cache .= ';'; } $survey_cache .= "\r\n?>"; $survey_cache = pwConvert($survey_cache, $db_charset, 'gbk'); pwCache::setData(D_P . "data/bbscache/survey_cache.php", $survey_cache); return new ApiResponse(true); }
function update($uploaddb) { global $timestamp, $db_charset; foreach ($uploaddb as $value) { $value['name'] = pwConvert($value['name'], $db_charset, 'utf-8'); $aid = $this->pw_attachs->add(array('uid' => $this->uid, 'hits' => 0, 'name' => $value['name'], 'type' => $value['type'], 'size' => $value['size'], 'attachurl' => $value['fileuploadurl'], 'uploadtime' => $timestamp, 'ifthumb' => $value['ifthumb'])); $this->attachs[$aid] = array('aid' => $aid, 'name' => stripslashes($value['name']), 'type' => $value['type'], 'attachurl' => $value['fileuploadurl'], 'size' => $value['size'], 'hits' => 0, 'desc' => str_replace('\\', '', $value['descrip']), 'ifthumb' => $value['ifthumb']); } return true; }
function ImgWaterMark($source, $w_pos = 0, $w_img = '', $w_text = '', $w_font = 12, $w_color = '#FF0000', $w_pct, $w_quality, $dstsrc = null) { global $imgdir, $db_waterfonts, $db_watermark; $sourcedb = $waterdb = array(); if (!($sourcedb = GetImgInfo($source))) { return false; } if ($db_watermark == 1 && GetImgInfo("{$imgdir}/water/{$w_img}")) { $waterdb = GetImgInfo("{$imgdir}/water/{$w_img}"); } elseif ($db_watermark == 2 && $w_text) { empty($db_waterfonts) && ($db_waterfonts = 'en/PilsenPlakat'); empty($w_font) && ($w_font = 12); $fontsfile = "{$imgdir}/fonts/{$db_waterfonts}.ttf"; $temp = imagettfbbox($w_font, 0, $fontsfile, $w_text); //取得使用 TrueType 字体的文本的范围 $waterdb['width'] = $temp[2] - $temp[6]; $waterdb['height'] = $temp[3] - $temp[7]; unset($temp); } else { return false; } if ($w_pos == 0) { $wX = rand(0, $sourcedb['width'] - $waterdb['width']); $wY = $db_watermark == 1 ? rand(0, $sourcedb['height'] - $waterdb['height']) : rand($waterdb['height'], $sourcedb['height']); } elseif ($w_pos == 1) { $wX = 5; $wY = $db_watermark == 1 ? 5 : $waterdb['height']; } elseif ($w_pos == 2) { $wX = ($sourcedb['width'] - $waterdb['width']) / 2; $wY = $db_watermark == 1 ? 5 : $waterdb['height']; } elseif ($w_pos == 3) { $wX = $sourcedb['width'] - $waterdb['width'] - 5; $wY = $db_watermark == 1 ? 5 : $waterdb['height']; } elseif ($w_pos == 4) { $wX = 5; $wY = $db_watermark == 1 ? $sourcedb['height'] - $waterdb['height'] - 5 : $sourcedb['height'] - 5; } elseif ($w_pos == 5) { $wX = ($sourcedb['width'] - $waterdb['width']) / 2; $wY = $db_watermark == 1 ? $sourcedb['height'] - $waterdb['height'] - 5 : $sourcedb['height'] - 5; } elseif ($w_pos == 6) { $wX = $sourcedb['width'] - $waterdb['width'] - 5; $wY = $db_watermark == 1 ? $sourcedb['height'] - $waterdb['height'] - 5 : $sourcedb['height'] - 5; } else { $wX = ($sourcedb['width'] - $waterdb['width']) / 2; $wY = $db_watermark == 1 ? ($sourcedb['height'] - $waterdb['height']) / 2 : ($sourcedb['height'] + $waterdb['height']) / 2; } imagealphablending($sourcedb['source'], true); if ($db_watermark == 1) { if ($waterdb['type'] == 'png') { $tmp = imagecreatetruecolor($sourcedb['width'], $sourcedb['height']); imagecopy($tmp, $sourcedb['source'], 0, 0, 0, 0, $sourcedb['width'], $sourcedb['height']); imagecopy($tmp, $waterdb['source'], $wX, $wY, 0, 0, $waterdb['width'], $waterdb['height']); $sourcedb['source'] = $tmp; //imagecopy($sourcedb['source'], $waterdb['source'], $wX, $wY, 0, 0, $waterdb['width'], $waterdb['height']); } else { imagecopymerge($sourcedb['source'], $waterdb['source'], $wX, $wY, 0, 0, $waterdb['width'], $waterdb['height'], $w_pct); } } else { if (strlen($w_color) != 7) { return false; } $R = hexdec(substr($w_color, 1, 2)); $G = hexdec(substr($w_color, 3, 2)); $B = hexdec(substr($w_color, 5)); //imagestring($sourcedb['source'],$w_font,$wX,$wY,$w_text,imagecolorallocate($sourcedb['source'],$R,$G,$B)); if (strpos($db_waterfonts, 'ch/') !== false && strtoupper($GLOBALS['db_charset']) != 'UTF-8') { $w_text = pwConvert($w_text, 'UTF-8', $GLOBALS['db_charset']); } imagettftext($sourcedb['source'], $w_font, 0, $wX, $wY, imagecolorallocate($sourcedb['source'], $R, $G, $B), $fontsfile, $w_text); } // P_unlink($source); $dstsrc && ($source = $dstsrc); MakeImage($sourcedb['type'], $sourcedb['source'], $source, $w_quality); isset($waterdb['source']) && imagedestroy($waterdb['source']); imagedestroy($sourcedb['source']); return true; }
/** * * @author pw team, Nov 13, 2010 * @copyright 2003-2010 phpwind.net. All rights reserved. * @version * @package default */ define('CK', 1); require_once 'global.php'; S::GP('q'); $qkey = intval($q); if (isset($db_question[$qkey])) { $question = $qkey < 0 ? getMachineQuestion_1() : $db_question[$qkey]; $array = array(); strtoupper($db_charset) == 'GBK' && ($question = pwConvert($question, 'UTF-8', 'GBK')); $len = strlen($question); for ($i = 0, $j = 0; $i < $len;) { ++$i; $ord = ord($question[$j]); if ($ord > 127) { if ($ord >= 192 && $ord <= 223) { ++$i; } elseif ($ord >= 224 && $ord <= 239) { $i = $i + 2; } elseif ($ord >= 240 && $ord <= 247) { $i = $i + 3; } } $array[] = substr($question, $j, $i - $j); $j = $i;