示例#1
0
                         echo '<div class="sync_list" style="background-image: url(images/i-tqq.gif);">' . trim($v['text']) . '</div>';
                     }
                 }
             }
         }
         mysql_free_result($q_dby);
     }
     break;
 case 'tsohu':
     if ($config['is_tsohu'] > 0 && ($config['is_utsohu'] > 0 || $config['tsohu_key'] != '' && $config['tsohu_se'] != '')) {
         $s_dby = sprintf('select s_id, s_t, s_s from %s where aid=%s and name=%s and is_show=0 limit 1', $dbprefix . 'm_sync', $id, SQLString('tsohu', 'text'));
         $q_dby = mysql_query($s_dby) or die('');
         $r_dby = mysql_fetch_assoc($q_dby);
         if (mysql_num_rows($q_dby) > 0) {
             require_once 'lib/SohuOAuth.php';
             $oauth = new SohuOAuth($config['tsohu_key'], $config['tsohu_se'], $r_dby['s_t'], $r_dby['s_s']);
             $url = 'http://api.t.sohu.com/statuses/user_timeline/' . $r_dby['s_id'] . '.json';
             $ma = $oauth->get($url, array('count' => 5));
             if (is_array($ma) && count($ma) > 0) {
                 foreach ($ma as $v) {
                     if (trim($v['text']) != '') {
                         echo '<div class="sync_list" style="background-image: url(images/i-tsohu.gif);">' . trim($v['text']) . '</div>';
                     }
                 }
             }
         }
         mysql_free_result($q_dby);
     }
     break;
 case 't163':
     if ($config['is_t163'] > 0 && $config['t163_key'] != '' && $config['t163_se'] != '') {
示例#2
0
     $q_dby = mysql_query($s_dby) or die('');
     $r_dby = mysql_fetch_assoc($q_dby);
     if (mysql_num_rows($q_dby) > 0) {
         require_once 'lib/t163.php';
         $tblog = new t163PHP($config['t163_key'], $config['t163_se'], $r_dby['s_t']);
         $tblog->update($a[0][0]);
     }
     mysql_free_result($q_dby);
 }
 if ($config['is_tsohu'] > 0 && ($config['is_utsohu'] > 0 || $config['tsohu_key'] != '' && $config['tsohu_se'] != '') && in_array('tsohu', $am)) {
     $s_dby = sprintf('select s_t, s_s from %s where aid=%s and name=%s limit 1', $dbprefix . 'm_sync', $aid, SQLString('tsohu', 'text'));
     $q_dby = mysql_query($s_dby) or die('');
     $r_dby = mysql_fetch_assoc($q_dby);
     if (mysql_num_rows($q_dby) > 0) {
         require_once 'lib/SohuOAuth.php';
         $oauth = new SohuOAuth($config['tsohu_key'], $config['tsohu_se'], $r_dby['s_t'], $r_dby['s_s']);
         $url = 'http://api.t.sohu.com/statuses/update.json';
         $oauth->post($url, array('status' => urlencode($a[0][0])));
     }
     mysql_free_result($q_dby);
 }
 if ($config['is_tw'] > 0 && $config['tw_key'] != '' && $config['tw_se'] != '' && in_array('twitter', $am)) {
     $s_dby = sprintf('select s_t, s_s from %s where aid=%s and name=%s limit 1', $dbprefix . 'm_sync', $aid, SQLString('twitter', 'text'));
     $q_dby = mysql_query($s_dby) or die('');
     $r_dby = mysql_fetch_assoc($q_dby);
     if (mysql_num_rows($q_dby) > 0) {
         require_once 'lib/twitterOAuth.php';
         $twitter = new TwitterOAuth($config['tw_key'], $config['tw_se'], $r_dby['s_t'], $r_dby['s_s']);
         $t_c = $twitter->OAuthRequest('https://twitter.com/statuses/update.xml', array('status' => $a[0][0]), 'POST');
     }
     mysql_free_result($q_dby);
示例#3
0
         $result = mysql_query($d_db) or die('');
         $me_url = 'http://t.sohu.com/u/' . $ma['id'];
         if ($r_dby['s_n'] != $me_url || $r_dby['s_id'] != $ma['id']) {
             $u_db = sprintf('update %s set s_n=%s, s_id=%s where id=%s', $dbprefix . 'm_sync', SQLString($me_url, 'text'), SQLString($ma['id'], 'text'), $r_dby['id']);
             $result = mysql_query($u_db) or die('');
         }
         $content .= '当前已绑定搜狐微博账号<table width="200"><tr><td align="center">' . ($ma['profile_image_url'] != '' ? '<img src="' . $ma['profile_image_url'] . '" alt=""/><br/>' : '') . '<a href="' . $me_url . '" target="_blank">' . $ma['screen_name'] . '</a>(<a href="?m=profile&amp;t=sync&amp;n=' . $nct . '&amp;lt=1">取消绑定</a>)</td></tr></table>';
         $content .= '<br/><br/><form method="post" action=""><input type="checkbox" name="is_show" value="1"' . ($r_dby['is_show'] > 0 ? ' checked="checked"' : '') . '/>隐藏已绑定搜狐微博账号相关信息<br/><input type="submit" value="更新" class="button"/><input type="hidden" name="isl_tsohu_h" value="' . $r_dby['id'] . '"/></form>';
     } else {
         $d_db = sprintf('delete from %s where aid=%s and name=%s', $dbprefix . 'm_sync', $r_dbu['id'], SQLString($nct, 'text'));
         $result = mysql_query($d_db) or die('');
     }
 }
 mysql_free_result($q_dby);
 if ($is_sync == 0) {
     $oauth = new SohuOAuth($config['tsohu_key'], $config['tsohu_se']);
     $request_token = $oauth->getRequestToken($config['site_url'] . 'tsohu_callback.php');
     $_SESSION['tsohu_token'] = $request_token['oauth_token'];
     $_SESSION['tsohu_secret'] = $request_token['oauth_token_secret'];
     switch ($oauth->http_code) {
         case 200:
             $aurl = $oauth->getAuthorizeUrl1($request_token['oauth_token'], $config['site_url'] . 'tsohu_callback.php');
             $content .= '<a href="' . $aurl . '">点击此处和您的搜狐微博账号建立连接</a>';
             break;
         default:
             $content .= '出错了,请稍后重试';
             break;
     }
 }
 $content .= '<br/><br/>绑定搜狐微博账号后将实现以下功能:<ol><li>将留言、评论、回复发布到搜狐微博</li><li>在<a href="?m=user&amp;id=' . $r_dbu['id'] . '">用户信息</a>页面显示最新的搜狐微博留言</li><li>使用搜狐微博账号登录</li><li>注:搜狐微博账号不可以重复绑定,用户绑定后,其他用户绑定的同一搜狐微博账号将自动解除绑定</li></ol>';
 break;
示例#4
0
     $_SESSION['tsohu_token'] = '';
     unset($_SESSION['tsohu_token']);
     $_SESSION['tsohu_secret'] = '';
     unset($_SESSION['tsohu_secret']);
 } else {
     $u = './?m=login&t=tsohu';
     $token = $_SESSION['tsohu_login_token'];
     $secret = $_SESSION['tsohu_login_secret'];
     $_SESSION['tsohu_login_token'] = '';
     unset($_SESSION['tsohu_login_token']);
     $_SESSION['tsohu_login_secret'] = '';
     unset($_SESSION['tsohu_login_secret']);
 }
 if ($token != '' && $secret != '') {
     require_once 'lib/SohuOAuth.php';
     $connection = new SohuOAuth($config['tsohu_key'], $config['tsohu_se'], $token, $secret);
     $last_key = $connection->getAccessToken($_REQUEST['oauth_verifier']);
     if ($last_key['oauth_token'] != '' && $last_key['oauth_token_secret'] != '') {
         if ($c_log) {
             $s_dby = sprintf('select id from %s where aid=%s and name=%s limit 1', $dbprefix . 'm_sync', $ar['id'], SQLString('tsohu', 'text'));
             $q_dby = mysql_query($s_dby) or die('');
             $r_dby = mysql_fetch_assoc($q_dby);
             if (mysql_num_rows($q_dby) > 0) {
                 $u_db = sprintf('update %s set s_t=%s, s_s=%s where id=%s', $dbprefix . 'm_sync', SQLString($last_key['oauth_token'], 'text'), SQLString($last_key['oauth_token_secret'], 'text'), $r_dby['id']);
                 $result = mysql_query($u_db) or die('');
             } else {
                 $i_db = sprintf('insert into %s (aid, name, s_t, s_s) values (%s, %s, %s, %s)', $dbprefix . 'm_sync', $ar['id'], SQLString('tsohu', 'text'), SQLString($last_key['oauth_token'], 'text'), SQLString($last_key['oauth_token_secret'], 'text'));
                 $result = mysql_query($i_db) or die('');
             }
             mysql_free_result($q_dby);
             setsinfo($ar['name'] . ' 绑定了搜狐微博', $ar['id']);