예제 #1
0
    function avatar_hover()
    {
        if ($this->post['uid']) {
            $u = M('user')->where(array('id' => $this->post['uid']))->select();
            echo '
						<div class="window_name"><a href="' . U('Visit/index?uid=' . $this->post['uid']) . '" target="_blank" title="' . $u[0]['name'] . '">' . getsubstr($u[0]['name'], 0, 8) . '</a>';
            if ($this->uid != NULL && $this->uid != $this->post['uid']) {
                echo '<div class="window_focus" id="follow">';
                if (M('follow')->where(array('hisid' => $this->post['uid'], 'myid' => $this->uid))->count() == 0) {
                    echo '关注TA';
                } else {
                    echo '取消关注';
                }
                echo '</div></div>';
            }
            echo '
						<div class="window_address" title="' . $u[0]['province'] . $u[0]['city'] . $u[0]['county'] . '">';
            if ($u[0]['province'] != '') {
                echo '来自' . getsubstr($u[0]['province'] . $u[0]['city'] . $u[0]['county'], 0, 9);
            } else {
                echo '暂无TA的位置信息';
            }
            echo '</div>
						<div class="window_score">当前积分:' . $u[0]['score'] . '</div>
						<input type="hidden" value="' . $this->post['uid'] . '" class="hisid" />
						<input type="hidden" value="' . U('Visit/index?uid=' . $this->post['uid']) . '" id="avatar_href" />
						';
        }
    }
예제 #2
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('&amp;', '&', $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);
             }
         }
     }
 }
 function search()
 {
     $question = M('question');
     $keywords = get_keywords($this->get['words']);
     $result_qid = array();
     $seachwords = M('searchwords');
     foreach ($keywords as $k => $v) {
         $qid = $seachwords->where(array('keywords' => $v))->select();
         foreach ($qid as $k2 => $v2) {
             array_push($result_qid, $v2['qid']);
         }
     }
     $result_qid = array_count_values($result_qid);
     arsort($result_qid);
     $result_qid = array_keys($result_qid);
     $p = $this->get['p'] ? $this->get['p'] : 1;
     $page_arr = array_slice($result_qid, ($p - 1) * 10, 10);
     $count = count($result_qid);
     $Page = new Page($count, 10);
     $show = $Page->show();
     $this->assign('page', $show);
     $question_list = $question->where(array('id' => array('in', $page_arr)))->select();
     $newkeywords = array();
     foreach ($keywords as $k => $v) {
         $newkeywords[$v] = '<span class="yellow">' . $v . '</span>';
     }
     unset($keywords);
     $this->assign('top', '对“' . getsubstr($this->get['words'], 0, 12) . '”的搜索结果,共找到' . $count . '个结果,关键词已高亮显示');
     $this->assign('keywords', $newkeywords);
     $this->assign('question_list', $question_list);
     $this->assign('title', '搜索结果');
     $this->display();
 }
}
?>
    
            </div>
            <div id="c_right">    
                <?php 
foreach (F('category') as $k => $v) {
    if ($k % 2 == 1) {
        echo '<div class="c_wrapper">
                    <div class="c_wrapper_inner" style="background-color:' . $v['color'] . '">
                        <img src="__PUBLIC__/thumbs/thumb_' . $v['thumb'] . '" class="c_thumb" />
                        <div class="c_detail"></div>
                        <a href="' . U('Index/clist?cid=' . $v['id']) . '" class="c_arrow" style="background-color:' . $v['color'] . '"></a>
                        <div class="c_info">
                            <h2>' . $v['title'] . '</h2>
                            <h3>' . getsubstr($v['describe'], 0, 36) . '</h3>
                        </div>
                    </div>
                    <div class="c_specific">
                        <h2>' . $v['title'] . '</h2>
                            <h3>' . $v['describe'] . '</h3>
                    </div>
                    <div class="c_shadow"></div>
                </div>';
    }
}
?>
            </div>
            <div class="clear"></div>
            <a id="enter_all" href="<?php 
echo U('Index/all');