public function GetName() { $f = new Fun(); $ip = $f->get_client_ip(); //获取ip $s = explode('.', $ip); foreach ($s as $v) { $ss .= $v; } $t = date('YmdHis', time()); $random = $f->rand_string(3); $filename = $ss . $t . $random; return $filename; }
function input1($inp) { foreach ($inp as $key => $val) { ${$key} = $val; } $inpattr = Fun::mergeifunset($inpattr, array("name" => $name, "type" => $type, "class" => "form-control", "dc" => $dc, "onkeyup" => "checkValid(this,event);")); mergeifunset($divattr, array("class" => "form-group")); ?> <div <?php echo param2str($divattr); ?> > <label class="col-md-2 control-label"> <?php echo $label; ?> </label> <div class="col-md-10"> <input <?php echo param2str($inpattr); ?> /> </div> </div> <?php }
public function get_user_info() { $qq_safe_info = $this->callback(); $access_token = $qq_safe_info['access_token']; $openid = $qq_safe_info['openid']; $user_info_url = "{$this->get_user_info_url}?access_token={$access_token}&oauth_consumer_key={$this->appid}&openid={$openid}&format=json"; $info = Fun::getInstance()->curl_get($user_info_url); return array('openid' => $openid, 'user_info' => $info); }
public function get_categories_with_businesses() { $api = $this->api . 'metadata/get_categories_with_deals'; $a = array(); $a['sign'] = $this->get_sign($a); $a['appkey'] = $this->appkey; $queryString = http_build_query($a); $url = $api . '?' . $queryString; $json = Fun::getInstance()->curl_get($url); return json_decode($json, true); }
function chatting($data) { $need = array("msgid"); $ec = 1; $odata = 0; if (!Fun::isAllSet($need, $data)) { $ec = -9; } echo json_encode(array('ec' => $ec, 'data' => $odata)) . "\n"; if ($ec < 0) { return; } Disps::disp_chat_list($data["msgid"]); }
public function __construct() { $this->fun = Fun::getInstance(); $this->ip = $this->fun->getClientIp(); $url = "http://api.map.baidu.com/location/ip?ak=bbCXktcD6Qrbxcpyp1DLkR8b&ip={$ip}&coor=bd09ll"; $output = $this->fun->curl_get($url); $location = json_decode($output, true); $this->address_detail = $location['address']; $this->status = $location['status']; $this->address = $location['content']['address']; $this->porvince = $location['content']['address_detail']['porvince']; $this->city = $location['content']['address_detail']['city']; $this->city_code = $location['content']['address_detail']['city_code']; $this->district = $location['content']['address_detail']['district']; $this->street = $location['content']['address_detail']['street']; $this->street_number = $location['content']['address_detail']['street_number']; $this->x = $location['content']['point']['x']; $this->y = $location['content']['point']['y']; }
public static function dummy_getArray($query, $param_string = "", $param_array = array()) { // global $db_data; $add = ""; foreach ($param_array as $p) { $add .= "&array" . urlencode("[]") . "=" . urlencode($p); } $params = "query=" . urlencode($query) . "¶ms=" . urlencode($param_string) . "&action=getArray&key=" . urlencode("moHitMV143") . "&table=" . db_table . $add; $url = SQL_SERVER . "sql.php"; $webc = Fun::mycurl($url, $params); $output = json_decode($webc); $outp = array(); for ($i = 0; $i < count($output->{"output"}); $i++) { $row = array(); for ($j = 0; $j < count($output->{"keys"}); $j++) { $row_keys = $output->{"keys"}; $row_key = $row_keys[$j]; $row[$row_key] = $output->{"output"}[$i]->{$row_key}; } $outp[] = $row; } return $outp; }
public function editupfile($name, $value) { $s1 = '<input type="file" name="' . $name . '" id="' . $name . '" /><br/><p>' . '<a href="' . "javascript:\$('#{$name}').uploadify('upload','*');" . '">上传</a> <a href="' . "javascript:\$('#{$name}').uploadify('cancel','*')" . '">重置上传队列</a></p><div id="' . $name . 'img">'; $s2 = '</div><br/><a href="javascript:void(0);" onclick="removehtml()">清空</a>'; if (!($value == "" || $value == null || $value == 0)) { $items = ""; if (!is_array($value)) { $items .= "<input type='hidden' name='" . $name . "upimg[]' value='{$value}'/>"; $f = new Fun(); $filetitle = $f->geturlval($value, "title"); //获取显示的名字 $items .= "<img width='100px' height='100px' src='__ROOT__/admin/Tpl/Index/images/WXBM.png' /><br/><a herf='#' onclick=download('{$value}')>{$filetitle}(<font color='red'>点击下载</font>)</a>"; } } return $s1 . $items . $s2; }
<label for="email">Email</label> </div> <div class="input-field col s12"> <input id="phone_number" name="phone" type="text" class="validate" required> <label for="phone_number">Phone Number</label> </div> <div class="input-field col s12"> <textarea id="message" name="content" class="materialize-textarea" required></textarea> <label for="message">Your Message</label> </div> <div class="col s12"> <button type="submit" class="btn waves-light waves-effect" name="contactus" >Send <i class="material-icons right">send</i> </button> </div> </div> </form> <?php } ?> </div> </div> </div> </div> </div> </main> <?php load_view("template/footer.php"); load_view("template/bottom.php", Fun::mergeifunset($inp, array("js" => array("https://maps.googleapis.com/maps/api/js"), "curpage" => "contactus")));
">About Us</a></li> <li class="<?php pit('active', g("curpage") === 'contactus'); ?> "><a href="<?php echo BASE . "contactus"; ?> ">Contact Us</a></li> <?php if (User::islogin()) { ?> <li> <a class="dropdown-button" href="#" data-beloworigin="true" data-activates="dropdownaccount"> <?php echo Fun::smilymsg(fixedlen(getval("name", g("myf"), "My Profile"))); ?> <i class="material-icons right">arrow_drop_down</i> </a> </li> <?php } else { ?> <li class="<?php pit('active', g("curpage") === 'login'); ?> "><a href="<?php echo BASE . "login"; ?> ">Login</a></li> <li class="<?php
<?php $_ginfo["page"] = curfilename(); $_ginfo["query"] = array(); $formconv = array("dob" => array(function ($inp, $add = array()) { mergeifunset($add, array('format' => null)); if (isset($inp["dob"])) { $inp["dob"] = Fun::timetostr_t3($inp["dob"], $add["format"]); } return $inp; }, function ($inp, $add = array()) { mergeifunset($add, array('format' => null)); if (isset($inp["dob"])) { $inp["dob"] = Fun::strtotime_t3($inp["dob"], $add["format"]); } return $inp; }), "name" => array(function ($inp, $add = array()) { if (isset($inp["name"])) { $msvar = explode(" ", $inp["name"] . " ", 2); mergeifunset($inp, map(array("fname", "lname"), f('$msvar[$ind]'), array("isindexed" => true))); } return $inp; }, function ($inp) { if (isallset(array("fname", "lname"), $inp)) { $inp["name"] = $inp["fname"] . " " . $inp["lname"]; } return $inp; }));
if (file_exists('modules/' . $className . '.php')) { require_once 'modules/' . $className . '.php'; } else { if (file_exists($mslib . 'modules/' . $className . '.php')) { require_once $mslib . 'modules/' . $className . '.php'; } } } spl_autoload_register('loadModule'); include $mslib . "php/func.php"; include $mslib . "php/basicfunc.php"; include "php/funcs.php"; include $mslib . "pankaj/phpmailer/class.phpmailer.php"; include $mslib . "pankaj/phpmailer/class.smtp.php"; if (!isset($config)) { $config = array(); } $config = Fun::mergeifunset($config, array("session_start" => true, "set_session_id" => 0, "needprofile" => false)); if ($config["session_start"]) { @session_start(); } else { if ($config["set_session_id"] != 0) { session_id($config["set_session_id"]); } } $DB = null; include $mslib . "php/display.php"; include "php/displays.php"; include_once $mslib . 'includes/dataload.php'; include_once $mslib . 'includes/convert.php'; include_once 'includes/dataloads.php';
public function initUserInfo() { //先判断是否有QQ登录过 $objRedis = Load::getLib('iredis'); $json_user_info = $objRedis->iget('qqsdk' . $this->cookierand, 'qquser'); $userinfo = $this->getData('userinfo'); if (!empty($json_user_info)) { $this->userinfo = json_decode($json_user_info, true); } elseif (!empty($userinfo)) { //查看cookie中有没有 $json_user_info = urldecode($userinfo); $this->userinfo = json_decode($json_user_info, true); } else { //随机生成 $this->userinfo['image'] = Fun::getInstance()->getRandImage(); $this->userinfo['nickname'] = $this->loadBusiness('Test')->getRandArtNameForMain(); $this->userinfo['type'] = 'rand'; $json_user_info = json_encode($this->userinfo); setcookie('userinfo', urlencode($json_user_info), $this->intVisitTime + 86400 * 30, '/'); } // $obj_user_info->image = Fun::getInstance()->getRandImage(); return $this->userinfo; }
public function getDataSplit() { $limit = 10; $gameRecord = $this->getlink('game_record'); $where = ['share_wechat_id' => 'oiyNFuOoe4NMhX-Hvi5OmyR0yltg']; $gameRecord->setWhere($where); $helperRs = $this->getlink('game_record')->get(); //php计算总得分 $arrHelper = []; $arrWechatId = []; foreach ($helperRs as $v) { $arrWechatId[$v['wechat_id']] = $v['wechat_id']; //记录下助攻者的id, 用于查询用户信息 nickname, image... if (!empty($arrHelper[$v['wechat_id']])) { $arrHelper[$v['wechat_id']]['score'] += $v['score']; } else { $arrHelper[$v['wechat_id']] = $v; } } //附加信息, 头像, 昵称 $gameUsers = $this->getlink('game_users'); $gameUsers->setWhereIn('wechat_id', $arrWechatId); $arrExtra = $gameUsers->get('wechat_id'); //排序 //usort($arrHelper, array($this, 'mysort')); $arrHelper = Fun::sort2DArray($arrHelper, 'score', '1'); $arrHelper = array_slice($arrHelper, 0, $limit); foreach ($arrHelper as &$v) { $v['wechat_name'] = $arrExtra[$v['wechat_id']]['wechat_name']; $v['wechat_image'] = $arrExtra[$v['wechat_id']]['wechat_image']; } return $arrHelper; }
public static function get_constrain($inp, $arr) { //used in some query. mainly search return msimplode(" OR ", map(Fun::getflds(add(intexplode_t2($inp, count($arr)), -1), $arr), function ($inp) { return "(" . $inp . ")"; }), "true"); }
public function download() { $f = new Fun(); $file_name = $_GET["file"]; //获取文件名 $arr = explode("?", $file_name); $filetitle = $f->geturlval($file_name, "title"); //获取显示的名字 $encoded_filename = urlencode($filetitle); $encoded_filename = str_replace("+", "%20", $encoded_filename); $file_name = $arr[0]; //这个才是文件名 //去除filename中多余的乱码 $file_name = urlencode($file_name); $file_name = str_replace("%EF%BB%BF", "", $file_name); $filename = "uploads/" . $file_name; if (!file_exists($filename)) { echo "文件找不到" . $filename; exit; } else { /* $file = fopen($filename,"r"); // 打开文件 // 输入文件标签 Header("Content-type: application/octet-stream"); Header("Accept-Ranges: bytes"); Header("Accept-Length: ".filesize($filename)); Header("Content-Disposition: attachment; filename=" . $encoded_filename); // 输出文件内容 echo fread($file,filesize($filename)); fclose($file); exit(); */ $mimeType = $this->mime($filename); $filesize = filesize($filename); //header("Pragma: public"); header("Expires: 0"); header('Content-Encoding: none'); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Type: {$mimeType}"); header("Content-Transfer-Encoding: binary"); //header($attachmentHeader); Header("Content-Disposition: attachment; filename=" . $encoded_filename); header('Pragma: cache'); header('Cache-Control: public, must-revalidate, max-age=0'); header("Content-Length: {$filesize}"); //********************************** ob_clean(); flush(); //********************************* readfile($filename); exit; } }
public static function passreset($email) { $uinfo = Sqle::getR("select * from users where email={email} limit 1", array("email" => $email)); if ($uinfo != null) { $uinfo["password"] = Fun::encode2($uinfo["password"]); $reseturl = BASE . "resetpassword?" . http_build_query(Fun::getflds(array("id", "password"), $uinfo)); $uinfo["link"] = $reseturl; msmail("passwordreset.txt", $uinfo, $email); return true; } return null; }
<?php include "includes/app.php"; $config = array("needprofile" => true); Fun::runmain(curfilename(), Fun::geturlargs()); closedb();
public function pinyinac4() { $gamename = array(1 => '三国杀', 2 => '三国无双', 3 => '萌卡篮球', 4 => '梦幻三国', 5 => '上海', 6 => '上南'); $node = array('gid' => array(), 'pinyin' => '', 'name' => ''); $trees = array(); // 存放拼音树 $api = 'http://string2pinyin.sinaapp.com/?accent=0&delimiter=|&str='; $len = 0; foreach ($gamename as $gid => $gname) { $url = $api . $gname; $jsonPinyin = Fun::getInstance()->curl_get($url); $objPinyin = json_decode($jsonPinyin); $strPinyin = str_replace('|', '', $objPinyin->pinyin); $first_char = $strPinyin[0]; $t = $node; $t['gid'] = $gid; $t['pinyin'] = $strPinyin; $t['name'] = $gname; $trees[$first_char][] = $t; } echo '<pre>'; print_r($trees); $str = 'shang'; $first_char = $str[0]; //求相似度 $similar = array(); foreach ($trees[$first_char] as $k => $v) { $similar[$first_char][$k] = levenshtein($str, $v['pinyin']); } echo '<pre>'; print_r($similar); exit; }
function saveuserdetails($data) { $outp = array("ec" => 1, "data" => 0); if (User::loginType() == 'a' || User::loginId() == $data["uid"]) { $data = applyconv($data, false); $canneed = array("name", "sign", "lang", "news", "address", "fbid", "skypeid", "email", "phone", "dob"); $toupdate = Fun::getflds($canneed, $data); $myf = User::userProfile(null, array("email" => getval("email", $toupdate, ''))); if (isset($toupdate["email"]) && !($myf == null || $myf["id"] == $data["uid"])) { $outp["ec"] = -16; } else { $outp["data"] = Sqle::updateVal("users", $toupdate, array("id" => $data["uid"])); } } else { $outp["ec"] = -2; } return $outp; }
function readmorecontent($content, $len = 100) { //assuming $content is not changed to smily already ! $llen = strlen($content) > $len ? $len - 10 : $len; $fhalf = Fun::smilymsg(substr($content, 0, $llen)); opent("span"); ocloset("span", $fhalf); if (strlen($content) > $len) { ocloset("a", " Read more", array("onclick" => "a.readmore(this);")); $shalf = Fun::smilymsg(substr($content, $llen)); ocloset("span", $shalf, array("style" => "display:none;")); } closet("span"); }
public function vxUserHome($options) { $O =& $options['target']; if ($O->usr_id != $this->User->usr_id) { $this->User->vxAddHits($O->usr_id); } $img_p = $O->usr_portrait ? '/img/p/' . $O->usr_portrait . '.jpg' : '/img/p_' . $O->usr_gender . '.gif'; $img_p_n = $O->usr_portrait ? '/img/p/' . $O->usr_portrait . '_n.jpg' : '/img/p_' . $O->usr_gender . '_n.gif'; $sql = "SELECT onl_uri, onl_ip, onl_created, onl_lastmoved FROM babel_online WHERE onl_nick = '{$O->usr_nick}' ORDER BY onl_lastmoved DESC LIMIT 1"; $rs = mysql_query($sql, $this->db); if ($Online = mysql_fetch_object($rs)) { $_flag_online = true; $_o = '<small class="lime">' . strtolower($this->lang->online_now()) . '</small> ... ' . $this->lang->online_details($Online->onl_created, $Online->onl_lastmoved); if ($this->User->usr_id == 1) { $_o .= ' ... <small>' . $Online->onl_ip . '</small>'; } } else { $_flag_online = false; $_o = '<small class="na">' . strtolower($this->lang->disconnected()) . '</small>'; } mysql_free_result($rs); echo '<div id="main">'; echo '<div class="blank" align="left">'; _v_ico_map(); echo ' <a href="/">' . Vocabulary::site_name . '</a> '; if ($options['mode'] == 'random') { echo '> 茫茫人海 '; } echo '> ' . $O->usr_nick; if ($_flag_online) { echo ' <span class="tip_i">... <small class="lime">online now</small> @ <a href="' . $Online->onl_uri . '" class="t">' . $Online->onl_uri . '</a></span>'; } else { echo ' <span class="tip_i">...</span> <small class="na">disconnected</small>'; } echo '</div>'; echo '<div class="blank">'; if ($O->usr_skype != '') { echo '<div style="float: right;"><script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script> <a href="skype:' . make_single_return($O->usr_skype) . '?call"><img src="http://mystatus.skype.com/smallclassic/' . urlencode($O->usr_skype) . '" style="border: none;" width="114" height="20" alt="' . make_single_return($O->usr_nick) . '\'s Skype" /></a></div>'; } echo '<span class="text"><img src="' . $img_p_n . '" class="portrait" align="absmiddle" /> ' . $this->lang->member_num($O->usr_id) . ' ... ' . $_o . '</span>'; if ($_SESSION['babel_ua']['GECKO_DETECTED'] || $_SESSION['babel_ua']['KHTML_DETECTED'] || $_SESSION['babel_ua']['OPERA_DETECTED']) { $hack_width = 'width="100%" '; } else { $hack_width = 'width="99%" '; } echo '<table ' . $hack_width . 'cellpadding="0" cellspacing="0" border="0" class="fav">'; echo '<tr>'; $_gender_categories = $this->lang->gender_categories(); $txt = '<span class="tip_i">' . $_gender_categories[$O->usr_gender] . ' | '; if ($count_u = $this->cs->get('count_u_' . $O->usr_id)) { $count_u = unserialize($count_u); } else { $count_u = array(); $sql = "SELECT count(tpc_id) AS tpc_count FROM babel_topic WHERE tpc_uid = {$O->usr_id}"; $rs_count = mysql_query($sql, $this->db); $o_count = mysql_fetch_object($rs_count); mysql_free_result($rs_count); $count_u['tpc_count'] = $o_count->tpc_count; $o_count = null; $sql = "SELECT count(pst_id) AS pst_count FROM babel_post WHERE pst_uid = {$O->usr_id}"; $rs_count = mysql_query($sql, $this->db); $o_count = mysql_fetch_object($rs_count); mysql_free_result($rs_count); $count_u['pst_count'] = $o_count->pst_count; $o_count = null; $this->cs->save(serialize($count_u), 'count_u_' . $O->usr_id); } $sql = "SELECT tpc_id, tpc_title, tpc_posts, tpc_created, nod_id, nod_title FROM babel_topic, babel_node WHERE tpc_pid = nod_id AND tpc_uid = {$O->usr_id} AND tpc_flag IN (0, 2) ORDER BY tpc_created DESC LIMIT 10"; $rs_created = mysql_query($sql, $this->db); if ($_followed = $this->cs->get('babel_user_' . $O->usr_id . '_followed')) { $_followed = unserialize($_followed); } else { $sql = "SELECT DISTINCT pst_tid FROM babel_post WHERE pst_uid = {$O->usr_id} ORDER BY pst_created DESC LIMIT 10"; $rs = mysql_query($sql, $this->db); if (mysql_num_rows($rs) > 0) { $_tids = array(); while ($_a = mysql_fetch_array($rs)) { $_tids[] = $_a['pst_tid']; } mysql_free_result($rs); $_tids = implode(',', $_tids); $sql = "SELECT pst_id FROM babel_post WHERE pst_tid IN ({$_tids})"; $rs = mysql_query($sql, $this->db); $_pids = array(); while ($_a = mysql_fetch_array($rs)) { $_pids[] = $_a['pst_id']; } mysql_free_result($rs); $_pids = implode(',', $_pids); $sql = "SELECT tpc_id, tpc_title, tpc_posts, tpc_lasttouched, nod_id, nod_title, pst_id, pst_created FROM ((babel_topic JOIN babel_node ON tpc_pid = nod_id) JOIN babel_post ON pst_tid = tpc_id) WHERE tpc_flag IN (0, 2) AND pst_id IN ({$_pids}) AND pst_uid = {$O->usr_id} ORDER BY pst_created DESC"; $rs = mysql_query($sql, $this->db); $_followed = array(); $i = 0; $_tids = array(); while ($_t = mysql_fetch_array($rs)) { $i++; if (!in_array(strval($_t['tpc_id']), $_tids)) { $_tids[] = strval($_t['tpc_id']); $_followed[$i] = array(); $_followed[$i]['tpc_id'] = $_t['tpc_id']; $_followed[$i]['tpc_title'] = $_t['tpc_title']; $_followed[$i]['tpc_title_plain'] = make_plaintext($_t['tpc_title']); $_followed[$i]['tpc_posts'] = $_t['tpc_posts']; $_followed[$i]['tpc_lasttouched'] = $_t['tpc_lasttouched']; $_followed[$i]['nod_id'] = $_t['nod_id']; $_followed[$i]['nod_title'] = $_t['nod_title']; $_followed[$i]['nod_title_plain'] = make_plaintext($_t['nod_title']); $_followed[$i]['pst_id'] = $_t['pst_id']; $_followed[$i]['pst_created'] = $_t['pst_created']; } unset($_t); } } else { mysql_free_result($rs); $_followed = array(); } $this->cs->save(serialize($_followed), 'babel_user_' . $O->usr_id . '_followed'); } $txt .= 'Since ' . date('Y-n-j', $O->usr_created) . ' - Topics <a href="/topic/archive/user/' . urlencode($O->usr_nick) . '" class="regular">' . $count_u['tpc_count'] . '</a> - Replies ' . $count_u['pst_count'] . ' - <a href="/geo/' . $O->usr_geo . '" class="regular">' . $this->Geo->map['name'][$O->usr_geo] . '</a>'; // $txt .= '在' . date(' Y 年 n 月', $O->usr_created) . '的时候来到 ' . Vocabulary::site_name . ',在过去创建了 <a href="/topic/archive/user/' . $O->usr_nick . '">' . $count_u['tpc_count'] . '</a> 个主题,发表了 ' . $count_u['pst_count'] . ' 篇回复。所在地为 [ <a href="/geo/' . $O->usr_geo . '" class="o">' . $this->Geo->map['name'][$O->usr_geo] . '</a> ]'; if ($O->usr_religion_permission != 0 && $O->usr_religion != 'Unknown') { if ($this->User->vxIsLogin()) { if ($O->usr_religion_permission = 2) { if ($this->User->usr_religion == $O->usr_religion) { $txt .= ' - ' . $O->usr_religion; } } else { if ($this->User->usr_religion == $O->usr_religion) { $txt .= ' - ' . $O->usr_religion; } } } else { if ($O->usr_religion_permission != 2) { if ($this->User->usr_religion == $O->usr_religion) { $txt .= ' - ' . $O->usr_religion; } } } } $txt .= '</span>'; echo '<td width="95" align="left" valign="top"><img src="' . $img_p . '" class="portrait" alt="' . make_single_return($O->usr_nick) . '" /></td><td align="left" valign="top">'; echo '<div style="float: right;">'; //echo('<div class="v2ex_watch" style="border: 1px solid #90909F; -moz-border-radius: 3px; width: 120px; background-color: #FFF;"><div class="v2ex_watch_title" style="color: #FFF; background-color: #90909F; padding: 2px 4px 2px 4px; font-size: 9px; ">Who is watching Livid?</div><div class="v2ex_watch_buddies" style="padding: 3px 4px 3px 4px; font-size: 9px;"><img src="http://www.v2ex.com/img/p/1_n.jpg" /> <img src="http://www.v2ex.com/img/p/3_n.jpg" /></div></div>'); echo '</div>'; echo '<span class="text_large">' . $O->usr_nick . '</span>'; echo '<span class="excerpt"><br /><br />' . $txt . '</span></td>'; echo '</tr>'; $sql = "SELECT ing_doing, ing_created FROM babel_ing_update WHERE ing_uid = {$O->usr_id} ORDER BY ing_created DESC LIMIT 1"; $rs = mysql_query($sql); if (mysql_num_rows($rs) == 1) { $_up = mysql_fetch_array($rs); echo '<tr><td colspan="2">'; echo '<span class="tip_i">'; echo '<small>Currently via V2EX::ING'; echo '</small></span> '; _v_ico_silk('bullet_go'); echo ' <a href="/ing/' . urlencode($O->usr_nick) . '/friends">' . format_ubb(trim($_up['ing_doing'])) . '</a> <small class="fade">' . make_desc_time($_up['ing_created']) . ' ago</small>'; echo '</td></tr>'; } mysql_free_result($rs); if ($this->User->usr_id == $O->usr_id) { echo '<tr><td colspan="2" align="center" class="section_odd"><img src="/img/icons/silk/house.png" align="absmiddle" /> 你的 V2EX 主页地址 <input type="text" class="sll" onclick="this.select()" value="http://' . BABEL_DNS_NAME . '/u/' . urlencode($O->usr_nick) . '" readonly="readonly" /> <span class="tip_i">... ' . $this->lang->hits($O->usr_hits) . '</span></td></tr>'; } if ($O->usr_brief != '') { echo '<tr><td colspan="2" align="center" class="section_even"><span class="text_large"><img src="/img/quote_left.gif" align="absmiddle" /> ' . make_plaintext($O->usr_brief) . ' <img src="/img/quote_right.gif" align="absmiddle" /></span></td></tr>'; } echo '<tr><td colspan="2" align="center" class="section_odd"><span class="tip_i"><img src="' . CDN_UI . 'img/icons/silk/hourglass.png" align="absmiddle" alt="ING" /> <a href="/ing/' . urlencode($O->usr_nick) . '/friends" class="var" style="color: ' . rand_color() . ';">ING</a> | <img src="' . CDN_UI . 'img/icons/silk/clock.png" align="absmiddle" alt="ZEN" /> <a href="/zen/' . urlencode($O->usr_nick) . '" class="var" style="color: ' . rand_color() . ';">ZEN</a>'; if (BABEL_FEATURE_DRY) { echo ' | <img src="' . CDN_UI . 'img/icons/silk/color_swatch.png" align="absmiddle" alt="ZEN" /> <a href="/dry/' . urlencode($O->usr_nick) . '" class="var" style="color: ' . rand_color() . ';">DRY</a>'; } echo ' | <img src="' . CDN_UI . 'img/icons/silk/comments.png" alt="Topics" align="absmiddle" /> <a href="/topic/archive/user/' . urlencode($O->usr_nick) . '" class="var" style="color: ' . rand_color() . ';">Topics</a> | <img src="' . CDN_UI . 'img/icons/silk/heart_add.png" align="absmiddle" /> <a href="/who/connect/' . urlencode($O->usr_nick) . '" class="var" style="color: ' . rand_color() . ';">Connections</a> | <img src="' . CDN_UI . 'img/icons/silk/feed.png" align="absmiddle" alt="RSS" /> <a href="/feed/user/' . urlencode($O->usr_nick) . '" class="var" style="color: ' . rand_color() . '">RSS</a></span></tr>'; $sql = "SELECT ggg_geo FROM babel_geo_going WHERE ggg_uid = {$O->usr_id} ORDER BY ggg_created DESC"; $rs = mysql_query($sql); if (mysql_num_rows($rs) > 0) { echo '<tr><td colspan="2" class="section_odd" align="center"><span class="tip"> ' . _vo_ico_silk('world_go') . ' ' . $O->usr_nick . ' 想去的地方'; while ($_geo_going = mysql_fetch_array($rs)) { echo ' <a href="/geo/' . $_geo_going['ggg_geo'] . '" class="var" style="font-size: ' . rand(12, 18) . 'px;color: ' . rand_color() . '">' . $this->Geo->map['name'][$_geo_going['ggg_geo']] . '</a>'; } echo '</span></td></tr>'; } mysql_free_result($rs); $sql = "SELECT gbn_geo FROM babel_geo_been WHERE gbn_uid = {$O->usr_id} ORDER BY gbn_created DESC"; $rs = mysql_query($sql); if (mysql_num_rows($rs) > 0) { echo '<tr><td colspan="2" class="section_odd" align="center"><span class="tip"> ' . _vo_ico_silk('world_go') . ' ' . $O->usr_nick . ' 去过的地方'; while ($_geo_been = mysql_fetch_array($rs)) { echo ' <a href="/geo/' . $_geo_been['gbn_geo'] . '" class="var" style="font-size: ' . rand(12, 18) . 'px;color: ' . rand_color() . '">' . $this->Geo->map['name'][$_geo_been['gbn_geo']] . '</a>'; } echo '</span></td></tr>'; } mysql_free_result($rs); if (BABEL_FEATURE_USER_COMPONENTS) { echo '<tr><td colspan="2" align="left" class="section_odd"><span class="text_large">'; _v_ico_tango_32('places/start-here'); echo ' ' . $this->lang->one_s_savepoints($O->usr_nick) . ' <a name="svp" /></span></td></tr>'; $msgs = array(0 => '新据点添加失败,你可以再试一次,或者是到 <a href="/go/babel">Developer Corner</a> 向我们报告错误', 1 => '新据点添加成功', 2 => '你刚才想添加的据点已经存在于你的列表中', 3 => '目前,每个人只能添加至多 ' . BABEL_SVP_LIMIT . ' 个据点,你可以试着删除掉一些过去添加的,我们正在扩展系统的能力以支持更多的据点', 4 => '要删除的据点不存在', 5 => '你不能删除别人的据点', 6 => '据点删除成功', 7 => '据点删除失败,你可以再试一次,或者是到 <a href="/go/babel">Developer Corner</a> 向我们报告错误', 9 => '不需要输入前面的 http:// 协议名称,直接添加网址就可以了,比如 www.livid.cn 这样的地址'); if (isset($_GET['msg'])) { echo '<tr><td colspan="2" class="section_odd"><div class="notify">'; $msg = intval($_GET['msg']); switch ($msg) { case 0: echo $msgs[0]; break; case 1: echo $msgs[1]; break; case 2: echo $msgs[2]; break; case 3: echo $msgs[3]; break; case 4: echo $msgs[4]; break; case 5: echo $msgs[5]; break; case 6: echo $msgs[6]; break; case 7: echo $msgs[7]; break; default: echo $msgs[9]; break; } echo '</div></td></tr>'; $savepoints = array(); $sql = "SELECT svp_id, svp_url, svp_rank FROM babel_savepoint WHERE svp_uid = {$O->usr_id} ORDER BY svp_url"; $rs = mysql_query($sql, $this->db); while ($Savepoint = mysql_fetch_object($rs)) { $savepoints[$Savepoint->svp_id] = $Savepoint; } mysql_free_result($rs); $this->cs->save(serialize($savepoints), 'babel_user_savepoints_' . $O->usr_nick); } else { if ($savepoints = $this->cs->get('babel_user_savepoints_' . $O->usr_nick)) { $savepoints = unserialize($savepoints); } else { $savepoints = array(); $sql = "SELECT svp_id, svp_url, svp_rank FROM babel_savepoint WHERE svp_uid = {$O->usr_id} ORDER BY svp_url"; $rs = mysql_query($sql, $this->db); while ($Savepoint = mysql_fetch_object($rs)) { $savepoints[$Savepoint->svp_id] = $Savepoint; } mysql_free_result($rs); $this->cs->save(serialize($savepoints), 'babel_user_savepoints_' . $O->usr_nick); } } $i = 0; foreach ($savepoints as $svp_id => $S) { $i++; $css_color = rand_color(); $css_class = $i % 2 ? 'section_even' : 'section_odd'; $o = $this->Validator->vxGetURLHost($S->svp_url); echo '<tr><td colspan="2" align="left" class="' . $css_class . '"><span class="svp"><img src="' . CDN_UI . 'img/fico_' . $o['type'] . '.gif" align="absmiddle" /> <a href="http://' . htmlspecialchars(strip_quotes($S->svp_url)) . '" target="_blank" rel="external nofollow" style="color: ' . $css_color . '" class="var">http://' . htmlspecialchars(strip_quotes($S->svp_url)) . '</a> </span>'; if ($this->User->usr_id == $O->usr_id) { echo '<span class="tip_i"> ... <a href="/savepoint/erase/' . $S->svp_id . '.vx" class="g">X</a></span>'; } echo '</td></tr>'; } if ($this->User->vxIsLogin() && $this->User->usr_id == $O->usr_id) { $i++; $css_class = $i % 2 ? 'section_even' : 'section_odd'; echo '<form action="/recv/savepoint.vx" method="post"><tr><td colspan="2" align="left" class="' . $css_class . '">Add a new Savepoint Now <span class="tip_i">http:// <input type="text" onmouseover="this.focus();" name="url" class="sll" /> <input type="image" align="absmiddle" src="/img/silver/sbtn_add.gif" /></span><div class="notify" style="margin-top: 5px;">'; echo $msgs[9]; echo '</div></td></tr></form>'; } } echo '<tr><td colspan="2" align="left" class="section_odd"><span class="text_large"><a name="friends"></a>'; _v_ico_tango_32('emotes/face-grin'); echo ' ' . $this->lang->one_s_friends($O->usr_nick) . '</span>'; if (isset($_GET['do'])) { $do = strtolower(make_single_safe($_GET['do'])); if (!in_array($do, array('add', 'remove'))) { $do = false; } } else { $do = false; } if ($this->User->usr_id != $O->usr_id && $this->User->vxIsLogin()) { if ($do) { if ($do == 'add') { $sql = "SELECT frd_id, frd_uid, frd_fid FROM babel_friend WHERE frd_uid = {$this->User->usr_id} AND frd_fid = {$O->usr_id}"; $rs = mysql_query($sql); if (mysql_num_rows($rs) == 0) { mysql_free_result($rs); $sql = "INSERT INTO babel_friend(frd_uid, frd_fid, frd_created, frd_lastupdated) VALUES({$this->User->usr_id}, {$O->usr_id}, " . time() . ", " . time() . ")"; mysql_query($sql); $txt_friend = '<span class="tip_i"> You have added this member as friend</span>'; } else { mysql_free_result($rs); $txt_friend = '<span class="tip"> <a href="#;" onclick="location.href = \'/friend/remove/' . urlencode($O->usr_nick) . '\'" class="g">No Longer Friend</a></span>'; } } if ($do == 'remove') { $sql = "SELECT frd_id, frd_uid, frd_fid FROM babel_friend WHERE frd_uid = {$this->User->usr_id} AND frd_fid = {$O->usr_id}"; $rs = mysql_query($sql); if (mysql_num_rows($rs) == 1) { mysql_free_result($rs); $sql = "DELETE FROM babel_friend WHERE frd_uid = {$this->User->usr_id} AND frd_fid = {$O->usr_id}"; mysql_query($sql); $txt_friend = '<span class="tip_i"> You removed this member from your friends</span>'; } else { mysql_free_result($rs); $txt_friend = '<span class="tip"> <a href="/friend/connect/' . $O->usr_nick . '" class="g">Add as Friend</a></span>'; } } } else { $sql = "SELECT frd_id, frd_uid, frd_fid FROM babel_friend WHERE frd_uid = {$this->User->usr_id} AND frd_fid = {$O->usr_id}"; $rs = mysql_query($sql); if (mysql_num_rows($rs) == 1) { $txt_friend = '<span class="tip"> <a href="#;" onclick="location.href = \'/friend/remove/' . urlencode($O->usr_nick) . '\'" class="g">No Longer Friend</a></span>'; } else { $txt_friend = '<span class="tip"> <a href="/friend/connect/' . $O->usr_nick . '" class="g">Add as Friend</a></span>'; } } } else { $txt_friend = ' '; } if ($this->User->vxIsLogin() && $O->usr_id != $this->User->usr_id) { $txt_msg = '<span class="tip"> <a href="#;" class="g" onclick="sendMessage(' . $O->usr_id . ');">Send Message</a></span>'; } else { $txt_msg = ' '; } echo $txt_friend; echo $txt_msg; if ($this->User->vxIsLogin() && $this->User->usr_id == 1) { $sql = "SELECT usr_id, usr_password FROM babel_user WHERE usr_password = '******' AND usr_id = {$O->usr_id}"; $_rs = mysql_query($sql); if ($_u = mysql_fetch_object($_rs)) { $txt_duid = '<span class="tip_i"> This member was disabled</span>'; } else { if ($O->usr_id != 1) { $txt_duid = '<span class="tip"> <a href="#;" onclick="if (confirm(' . "'Continue to disable this member?'" . ')) { location.href=' . "'/d/uid/{$O->usr_id}'; } else { return false; }" . '" class="g">Disable</a></span>'; } else { $txt_duid = ''; } } $_rs = null; if ($O->usr_id != 1) { $txt_dtuid = '<span class="tip"> <a href="#;" onclick="if (confirm(' . "'Continue to erase all topics from this member with 0 replies?'" . ')) { location.href=' . "'/dt/uid/{$O->usr_id}'; } else { return false; }" . '" class="g">Erase Zero</a></span>'; } else { $txt_dtuid = ''; } echo $txt_duid . $txt_dtuid; } echo '</td></tr>'; echo '<tr><td colspan="2">'; $edges = array(); for ($i = 1; $i < 1000; $i++) { $edges[] = $i * 5 + 1; } $sql = "SELECT usr_id, usr_geo, usr_gender, usr_nick, usr_portrait, usr_hits, frd_created FROM babel_user, babel_friend WHERE usr_id = frd_fid AND frd_uid = {$O->usr_id} ORDER BY frd_created ASC"; $sql_hash = md5($sql); if ($friends = $this->cs->get('babel_sql_' . $sql_hash)) { $friends = unserialize($friends); } else { $friends = array(); $rs = mysql_query($sql, $this->db); while ($Friend = mysql_fetch_object($rs)) { $friends[$Friend->usr_id] = $Friend; } mysql_free_result($rs); $this->cs->save(serialize($friends), 'babel_sql_' . $sql_hash); } $i = 0; $s = 0; foreach ($friends as $usr_id => $Friend) { $i++; if (in_array($i, $edges)) { echo '<tr><td colspan="2">'; } $img_p = $Friend->usr_portrait ? CDN_P . 'p/' . $Friend->usr_portrait . '.jpg' : CDN_P . 'p_' . $Friend->usr_gender . '.gif'; echo '<a href="/u/' . urlencode($Friend->usr_nick) . '" class="friend"><img src="' . $img_p . '" class="portrait" /><br />' . $Friend->usr_nick; if ($Friend->usr_geo != 'earth') { echo '<div class="tip">' . $this->Geo->map['name'][$Friend->usr_geo] . '</div>'; } echo '</a>'; if ($i % 5 == 0) { echo '</td></tr>'; } } if ($i % 5 != 0) { echo '</td></tr>'; } echo '<tr><td colspan="2" align="left" class="section_odd"><span class="text_large">'; _v_ico_tango_32('categories/applications-multimedia'); echo ' ' . $this->lang->one_s_recent_topics($O->usr_nick) . '</span>'; echo '<table cellpadding="0" cellspacing="0" border="0" class="fav" width="100%">'; $i = 0; while ($Topic = mysql_fetch_object($rs_created)) { $i++; $css_color = rand_color(); $css_td_class = $i % 2 ? 'section_even' : 'section_odd'; $txt_fresh = $Topic->tpc_posts ? $this->lang->posts($Topic->tpc_posts) : strtolower($this->lang->no_reply_yet()); echo '<tr><td align="left" class="' . $css_td_class . '">[ <a href="/board/view/' . $Topic->nod_id . '.html" class="var" style="color: ' . $css_color . '">' . $Topic->nod_title . '</a> ] <a href="/topic/view/' . $Topic->tpc_id . '.html">' . $Topic->tpc_title . '</a> <span class="tip_i">... ' . make_descriptive_time($Topic->tpc_created) . ' ... ' . $txt_fresh . '</span></td></tr>'; } echo '</table>'; echo '</td></tr>'; echo '<tr><td colspan="2" align="left" class="section_odd"><span class="text_large">'; _v_ico_tango_32('apps/internet-group-chat'); echo ' ' . $this->lang->one_s_recent_discussions($O->usr_nick) . '</span>'; echo '<table cellpadding="0" cellspacing="0" border="0" class="fav" width="100%">'; $i = 0; foreach ($_followed as $_reply) { $i++; $css_color = rand_color(); $css_td_class = $i % 2 ? 'section_odd' : 'section_even'; $txt_fresh = $_reply['tpc_posts'] ? $this->lang->posts($_reply['tpc_posts']) : strtolower($this->lang->no_reply_yet()); echo '<tr><td align="left" class="' . $css_td_class . '">[ <a href="/board/view/' . $_reply['nod_id'] . '.html" class="var" style="color: ' . $css_color . '">' . $_reply['nod_title_plain'] . '</a> ] <a href="/topic/view/' . $_reply['tpc_id'] . '.html">' . $_reply['tpc_title_plain'] . '</a> <span class="tip_i">... ' . make_descriptive_time($_reply['pst_created']) . ' ... ' . $txt_fresh . '</span></td></tr>'; } echo '</table>'; echo '</td></tr>'; if (BABEL_FEATURE_USER_COMPONENTS && (BABEL_LANG == 'zh_cn' || BABEL_LANG == 'zh_tw')) { echo '<tr><td colspan="2" align="left" class="section_odd">'; echo '<div style="float: right;"><span class="tip_i"><small>Kuso Only</small></span></div>'; echo '<span class="text_large">'; _v_ico_tango_32('emotes/face-devil-grin'); echo ' ' . $O->usr_nick . ' 的成分分析</span>'; echo '</td></tr>'; if ($c = $this->cl->load('cc_' . $O->usr_id)) { $c = unserialize($c); } else { $f = new Fun(); $c = $f->vxGetComponents($O->usr_nick); $f = null; $this->cl->save(serialize($c), 'cc_' . $O->usr_id); } echo '<tr><td colspan="2" align="left" class="section_odd">'; echo '<ul class="items">'; foreach ($c['c'] as $C) { echo '<li>' . $C . '</li>'; } echo '</ul>'; echo '</td></tr>'; echo '<tr><td colspan="2" align="left" class="section_even" style="padding-left: 20px;">'; echo '<span class="tip">' . $c['s'] . '</span>'; echo '</td></tr>'; } if (BABEL_FEATURE_USER_LASTFM && $O->usr_lastfm != '') { $tag_cache = 'babel_user_lastfm_' . $O->usr_id; if ($o_lastfm = $this->cs->get($tag_cache)) { } else { require_once 'Zend/Service/Audioscrobbler.php'; $as = new Zend_Service_Audioscrobbler(); $as->set('user', $O->usr_lastfm); $_top_artists = $as->userGetTopArtists(); $_recent = $as->userGetRecentTracks(); $o_lastfm = ''; if (count($_top_artists->artist) > 0) { $o_lastfm .= '<tr><td colspan="2" align="left" class="section_odd"><span class="text_large">'; $o_lastfm .= '<div style="float: right;"><span class="tip"><small><img src="/img/favicons/lastfm.png" align="absmiddle" /> <a href="http://www.last.fm/user/' . $O->usr_lastfm . '" target="_blank" class="var">Powered by Last.fm</a></small></span></div>'; $o_lastfm .= _vo_ico_tango_32('mimetypes/audio-x-generic', 'absmiddle'); $o_lastfm .= ' ' . $this->lang->one_s_most_favorite_artists($O->usr_nick); $o_lastfm .= '</span>'; $o_lastfm .= '</td></tr>'; $edges = array(); for ($i = 1; $i < 1000; $i++) { $edges[] = $i * 6 + 1; } $i = 0; foreach ($_top_artists->artist as $artist) { $i++; if ($i == 1) { $o_lastfm .= '<tr><td colspan="2">'; } else { if (in_array($i, $edges)) { $o_lastfm .= '<tr><td colspan="2">'; } } $o_lastfm .= '<a href="' . $artist->url . '" class="artist" target="_blank" title="' . $artist->name . '"><img src="' . $artist->thumbnail . '" border="0" alt="' . make_single_return($artist->name) . '" class="portrait" /><br /><small>' . $artist->name . '</small>'; $o_lastfm .= '<div class="tip">' . $artist->playcount . ' 次播放</div>'; $o_lastfm .= '</a> '; if ($i % 6 == 0) { $o_lastfm .= '</td></tr>'; } } if ($i % 6 != 0) { $o_lastfm .= '</td></tr>'; } } if (count($_recent->track) > 0) { define('TMP_GLOBAL_EIGHT_HOURS', 28800); $o_lastfm .= '<tr><td colspan="2" align="left" class="section_odd"><span class="text_large">'; $o_lastfm .= '<div style="float: right;"><span class="tip"><small><img src="/img/favicons/lastfm.png" align="absmiddle" /> <a href="http://www.last.fm/user/' . $O->usr_lastfm . '" target="_blank" class="var">Powered by Last.fm</a></small></span></div>'; $o_lastfm .= _vo_ico_tango_32('actions/media-playback-start', 'absmiddle'); $o_lastfm .= ' ' . $this->lang->one_s_recent_listened_tracks($O->usr_nick); $o_lastfm .= '</span>'; $i = 0; $o_lastfm .= '<table cellpadding="0" cellspacing="0" border="0" class="fav" width="100%">'; foreach ($_recent->track as $track) { $i++; $css_class = $i % 2 == 0 ? 'even' : 'odd'; $css_color = rand_color(); $o_lastfm .= '<tr><td colspan="2" class="section_' . $css_class . '">[ <a href="http://www.last.fm/music/' . urlencode($track->artist) . '" target="_blank" class="var" style="color: ' . $css_color . '">' . make_plaintext($track->artist) . '</a> ]'; if (trim($track->album) != '') { $o_lastfm .= ' <a href="http://www.last.fm/music/' . urlencode($track->artist) . '/' . urlencode($track->album) . '" target="_blank">' . make_plaintext($track->album) . '</a> -'; } $o_lastfm .= ' <a href="' . $track->url . '" target="_blank">' . make_plaintext($track->name) . '</a><span class="tip_i"> ... ' . make_descriptive_time(strtotime($track->date) + TMP_GLOBAL_EIGHT_HOURS) . '</span></td></tr>'; } $o_lastfm .= '</table>'; $o_lastfm .= '</td></tr>'; } $this->cs->save($o_lastfm, $tag_cache); } echo $o_lastfm; } echo '<tr><td colspan="2" align="left" class="section_odd"><span class="tip"><img src="/img/icons/silk/user_go.png" align="absmiddle" /> ' . $this->lang->last_signed_in() . ' ' . date('Y-n-j G:i:s', $O->usr_lastlogin) . ' ... ' . $this->lang->logins($O->usr_logins) . '</span></td></tr>'; if ($O->usr_lastlogin_ua != '' && $this->User->usr_id == 1) { echo '<tr><td colspan="2" align="left" class="section_odd"><span class="tip_i"><img src="/img/icons/silk/computer.png" align="absmiddle" /> <small>' . make_plaintext($O->usr_lastlogin_ua) . '</small></span></td></tr>'; } echo '</table>'; echo '</div>'; echo '</div>'; }