예제 #1
0
 if ($uid) {
     $sql = "select user_name,user_head from et_users where user_id='{$uid}'";
     $query = $db->query($sql);
     $data = $db->fetch_array($query);
     $name = $data['user_name'];
     $uheader = $data['user_head'] ? "../attachments/head/" . $data['user_head'] : "../images/noavatar.jpg";
     if (!file_exists($uheader)) {
         $uheader = "../images/noavatar.jpg";
     }
     if ($name) {
         ob_start();
         $sql = "select content_body,posttime,type from et_content where user_id='{$uid}' order by content_id desc limit 1";
         $query = $db->query($sql);
         $data = $db->fetch_array($query);
         $content = $data['content_body'];
         $content = apiurlreplace($content);
         $content = clean_html($content);
         $type = $data['type'];
         $ctime = gmdate('Y-m-d H:i:s', $data['posttime'] + 8 * 3600);
         $img = imagecreatefrompng("../images/sign.png");
         $pic = imagecreatefromjpeg($uheader);
         imagecopy($img, $pic, 10, 10, 0, 0, 96, 96);
         $textColor = imagecolorallocate($img, 0, 0, 255);
         $string = iconv("GB2312", "UTF-8", "{$name}");
         imagettftext($img, 15, 0, 120, 25, $textColor, "../include/simhei.ttf", $string);
         $content = get_substr($content, 0, 95);
         if ($content == "") {
             $content = "尚未发表信息! " . gmdate('Y-m-d H:i:s', time() + 8 * 3600);
         } else {
             $content = $content . " " . $ctime . " 通过" . $type;
         }
예제 #2
0
    $query = $db->query($sql);
    $row = $db->fetch_array($query);
    $uname = $row['user_name'];
    $uname = iconv("GB2312", "UTF-8", $uname);
    if (!$uname) {
        $err = "1022";
    } else {
        $err = "1009";
    }
    echo "<?xml version=\"1.0\" encoding=\"gbk\"?>\n" . "<root>\n" . "<err>{$err}</err>\n" . "<info>\n" . "<pg>\n" . "<num>{$count}</num>\n" . "<total>{$total}</total>\n" . "</pg>\n" . "<us>\n" . "<me>{$uname}</me>\n" . "<mesn>{$id}</mesn>\n" . "</us>\n";
    $sql = "SELECT s.*,u.user_name,u.user_head,u.user_info FROM et_content AS s,et_users AS u where s.user_id=u.user_id && s.user_id='{$id}' order by posttime desc limit {$count}";
    $query = $db->query($sql);
    while ($data = $db->fetch_array($query)) {
        $xml_sid = $data['content_id'];
        $xml_uid = $data['user_id'];
        $xml_uname = $data['user_name'];
        $xml_uinfo = $data['user_info'];
        $xml_uhead = $data['user_head'] ? "{$webaddr}/attachments/head/" . $data['user_head'] : "images/noavatar.jpg";
        $xml_cbody = trim(clean_html($data['content_body'])) == "" ? "此条TALK暂时无法显示" : trim(clean_html($data['content_body']));
        $xml_cbody = apiurlreplace($xml_cbody);
        $xml_cbody = iconv("GB2312", "UTF-8", $xml_cbody);
        $xml_stime = $data['posttime'];
        $xml_stime = gmdate('y-m-d H:m:s', $xml_stime + 8 * 3600);
        $xml_type = $data['type'];
        $xml_type = iconv("GB2312", "UTF-8", $xml_type);
        $t = "<ml>\n" . "<id>{$xml_sid}</id>\n" . "<uid>{$xml_uid}</uid>\n" . "<cn>{$xml_cbody}</cn>\n" . "<t>{$xml_stime}</t>\n" . "<sr>{$xml_type}</sr>\n" . "</ml>\n";
        $res = $res . $t;
    }
    $res = $res ? "<md>\n" . $res . "</md>\n" : "";
    echo "{$res}</info>\n" . "</root>\n";
}
예제 #3
0
     echo "[";
 }
 $sql = "SELECT s.content_id,s.content_body,s.posttime,s.type,s.status_id,s.status_uid,u.user_id,u.user_name,u.home_city,u.live_city,u.user_info,u.user_head,u.isclose,t.topic_id,t.topic_body,t.open FROM et_users AS u,et_content AS s left join et_topic AS t on s.topicid=t.topic_id && t.open=1 where s.user_id=u.user_id order && s.user_id='{$id}' by s.content_id desc limit {$start},{$count}";
 $query = $db->query($sql);
 while ($data = $db->fetch_array($query)) {
     $json_sid = $data['content_id'];
     $json_uid = $data['user_id'];
     $json_uname = $data['user_name'];
     $json_homecity = $data['home_city'] == "选择省份 选择城市" || $data['home_city'] == "0" ? "" : $data['home_city'];
     $json_livecity = $data['live_city'] == "选择省份 选择城市" || $data['live_city'] == "0" ? "" : $data['live_city'];
     $json_uinfo = $data['user_info'];
     $json_uhead = $data['user_head'] ? "{$webaddr}/attachments/head/" . $data['user_head'] : "{$webaddr}/images/noavatar.jpg";
     $json_topicbody = $data['topic_body'] ? "<a href='{$webaddr}/op/topic/{$data['topic_id']}'>[" . $data['topic_body'] . "]</a> " : "";
     $json_cbody = $json_topicbody . $data['content_body'];
     $json_cbody = $format == "html" ? htmlspecialchars($json_cbody) : clean_html($json_cbody);
     $json_cbody = apiurlreplace($json_cbody);
     $json_statusid = $data['status_id'] ? $data['status_id'] : "";
     $json_statusuid = $data['status_uid'] ? $data['status_uid'] : "";
     $json_stime = $data['posttime'];
     $json_stime = gmdate('Y-m-d H:m:s', $json_stime + 8 * 3600);
     $json_isclose = $data['isclose'] == 1 ? "true" : "false";
     $tem = "{\"created_at\":\"{$json_stime}\",\"id\":\"{$json_sid}\",\"text\":\"{$json_cbody}\",\"reply_to_status_id\"=\"{$json_statusid}\",\"reply_to_user_id\"=\"{$json_statusuid}\",\"user\":{\"id\":\"{$json_uid}\",\"name\":\"{$json_uname}\",\"homelocation\":\"{$json_homecity}\",\"livelocation\":\"{$json_livecity}\",\"description\":\"{$json_uinfo}\",\"profile_image_url\":\"{$json_uhead}\",\"protected\":\"{$json_isclose}\",\"url\":\"{$webaddr}/home/u.{$json_uid}\"}},";
     $tem = str_replace(array("\r", "\n"), array("", "<br />"), $tem);
     $json_meg = $json_meg . $tem;
 }
 $json_meg = substr("{$json_meg}", 0, -1);
 echo $json_meg;
 if ($callback) {
     echo "])";
 } else {
     echo "]";