Example #1
0
 function sendtalk()
 {
     $weibo = D('Weibobind');
     $ctent = D('Content');
     $user = Action::$login_user;
     $contentid = mysql_insert_id();
     if ($contentid) {
         $content = $ctent->where("content_id='{$contentid}'")->find();
         $text = $content['content_body'];
         $media = $content['media_body'];
         $text = str_replace('&', '&', $text);
         $text = ubbreplace($text);
         $media = ubbreplace($content['media_body']);
         $st = getsubstr($media, 0, 7, false);
         if ($st == 'http://' || $st == '/photo/') {
             if ($st == '/photo/') {
                 $media = __PUBLIC__ . '/attachments' . $media;
                 $media = str_replace('s_', '', $media);
             }
             $text = $text . $media;
         }
         $text = clean_html($text);
     }
     if ($text) {
         $bind = $weibo->where("uid='{$user['user_id']}'")->find();
         if ($bind['sina_uid'] && $bind['sina_token'] && $bind['sina_tsecret'] && $bind['sendtosina'] == 1) {
             $sinawb = new WeiboClient(WB_AKEY, WB_SKEY, $bind['sina_token'], $bind['sina_tsecret']);
             $me = $sinawb->verify_credentials();
             if ($me['id'] == $bind['sina_uid']) {
                 $rssina = $sinawb->update($text);
             }
         }
         if ($bind['qq_uid'] && $bind['qq_token'] && $bind['qq_tsecret'] && $bind['sendtoqq'] == 1) {
             include_once "qqweibo/api_client.php";
             $qqwb = new MBApiClient(MB_AKEY, MB_SKEY, $bind['qq_token'], $bind['qq_tsecret']);
             $me = $qqwb->getUserInfo();
             if ($me['data']['name'] == $bind['qq_uid']) {
                 $p = array('c' => $text, 'ip' => $_SERVER['REMOTE_ADDR'], 'j' => '', 'w' => '');
                 $rsqq = $qqwb->postOne($p);
             }
         }
     }
 }
Example #2
0
function simplecontent($content, $len = 50)
{
    $sc = clean_html(trim($content));
    $sc = ubbreplace($sc);
    $sc = clean_http($sc);
    if ($len != 0) {
        $sc = getsubstrutf8($sc, 0, $len, true);
    }
    $sc = $sc ? $sc : "还没有说什么!";
    return $sc;
}
Example #3
0
<?php

$API = 1;
include '../common.inc.php';
$username = $_GET['user_name'];
$user = user_info("user_name='{$username}'");
if (!$user) {
    echo "不存在该用户";
    exit;
}
header("Content-type: application/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" . "  <rss version=\"2.0\">\n" . "  <channel>\n" . "  <title>{$user[nickname]} - 贫嘴</title>\n" . "  <link>{$webaddr}/{$user[user_name]}</link>\n" . "  <description>贫嘴 - 看看 {$user[nickname]} 在做什么…</description>\n" . "  <webMaster></webMaster>\n" . "  <language>zh-cn</language>\n" . "  <image>\n" . "  <link>{$webaddr}</link>\n" . "  <url>{$webaddr}/images/default/logo.png</url>\n" . "  <title>贫嘴</title>\n" . "  </image>\n";
$query = $db->query("SELECT * FROM et_content WHERE user_name='{$username}' && privacy=0 && replyshow=1 ORDER BY content_id DESC LIMIT 20");
while ($data = $db->fetch_array($query)) {
    $contents = clean_html($data['content_body']);
    $contents = ubbreplace($contents);
    $title = getsubstrutf8($contents, 0, 30, true);
    echo "    <item>\n" . "     <title>{$data[user_nickname]}: {$title}</title>\n" . "     <description><![CDATA[{$data['user_nickname']}: {$contents}]]></description>\n" . "     <pubDate>" . date("r", $data['posttime']) . "</pubDate>\n" . "     <link>{$webaddr}/op/view/{$data['content_id']}</link>\n" . "   </item>\n";
}
echo "  </channel>\n" . "  </rss>";