function like_show()
{
    $args = func_get_args();
    if (get_post('page')) {
        $page = intval(get_post('page'));
    } else {
        $page = "";
    }
    $content = '';
    include_once "theme.inc.php";
    $favorites = get_likes(10, $page);
    include_once "apply_sent.inc.php";
    $allapp = get_sent_applies(32767, "");
    foreach ($favorites as $f) {
        $content .= '<div class="item" id="' . $f['tweet_id'] . '">
                   <div class="item-delete">
                       <a class="right"></a>
                   </div>
                   <div class="left item-pic">
                       <img src="' . $f['profile_image_url'] . '" alt="" width="50" height="50" />
                   </div>
                   <div class="left item-content">
                       <div class="item-blog">
                           <a class="item-blog-name">' . $f['post_screenname'] . '</a>:' . $f['content'] . '
                       </div>
                       <div class="item-other">
                           <a target="_blank" href="http://api.t.sina.com.cn/' . $r['user_site_id'] . '/statuses/' . $r['tweet_site_id'] . '" class="left item-time">' . time_tran($f['post_datetime']) . '</a> ' . $source . '
                           <a class="right item-favourite item-action delete">取消收藏</a> ';
        if ($f['type'] != 1) {
            $app = 0;
            foreach ($allapp as $r) {
                if ($f['tweet_id'] == $r['tweet_id']) {
                    $app = 1;
                    break;
                }
            }
            if (!$app) {
                $content .= '<a class="right item-favourite item-doapply apply" onclick="JobApply(this,\'' . $f['tweet_id'] . '\',\'' . $f['post_screenname'] . '\')">
                                            申请该职位</a><a class="right item-favourite item-doapply unapply" style="display: none;" onclick="JobUnApply(this,\'' . $f['tweet_id'] . '\')">
                                            取消申请</a>';
            } else {
                $content .= '<a class="right item-favourite item-doapply apply" style="display: none;" onclick="JobApply(this,\'' . $f['tweet_id'] . '\',\'' . $f['post_screenname'] . '\')">
                                            申请该职位</a><a class="right item-favourite item-doapply unapply" onclick="JobUnApply(this,\'' . $f['tweet_id'] . '\')">
                                            取消申请</a>';
            }
        }
        $content .= '
                       </div>
                   </div>
                   <div class="clear">
                   </div>
               </div>';
    }
    echo $content;
}
function apply_sent_show()
{
    include_once "theme.inc.php";
    $args = func_get_args();
    if (get_post('page')) {
        $page = intval(get_post('page'));
    } else {
        $page = "";
    }
    $content = '';
    $applies = get_sent_applies(10, $page);
    foreach ($applies as $f) {
        if (strstr($f['source'], '<')) {
            $source = str_replace("<a ", '<a class="left microblog-item-position"', $f['source']);
        } else {
            $source = '<a class="left microblog-item-position">' . $f['source'] . '</a>';
        }
        if ($f['deleted']) {
            $temp = " job-closed";
        } else {
            $temp = "";
        }
        $content .= '<div class="item' . $temp . '" id="' . $f['tweet_id'] . '">
                   <div class="item-delete">
                       <a class="right"></a>
                   </div>
                   <div class="left item-pic">
                       <img src="' . $f['profile_image_url'] . '" alt="" width="50" height="50" />
                   </div>
                   <div class="left item-content">
                       <div class="item-blog">
                           <a class="item-blog-name">' . $f['post_screenname'] . '</a>:' . $f['content'] . '
                       </div>
                       <div class="item-other">
                           <span class="left item-time">' . time_tran($f['post_datetime']) . '</span> ' . $source;
        if ($f['deleted']) {
            $content .= '<span class="right item-apply item-apply-info">已关闭</span>';
        } elseif ($f['view_time']) {
            $content .= '<span class="right item-apply item-apply-info">' . time_tran($f['view_time']) . '</span>';
        } else {
            $content .= '<span class="right item-apply item-apply-info">未读</span>';
        }
        $content .= '<span class="right item-apply item-apply-name">状态:</span> <span class="right item-apply item-apply-info">' . time_tran($f['apply_time']) . '</span> <span class="right item-apply item-apply-name">
                            申请于:</span>';
        $content .= '
                       </div>
                   </div>
                   <div class="clear">
                   </div>
               </div>';
    }
    echo $content;
}
function theme_result($result, $keyword = '', $admin = false)
{
    include_once "login.inc.php";
    include_once "hot.inc.php";
    if (user_is_authenticated()) {
        include_once "like.inc.php";
        $allfav = get_likes(32767, "");
        include_once "apply_sent.inc.php";
        $allapp = get_sent_applies(32767, "");
    }
    $content = "";
    foreach ($result as $r) {
        if ($keyword) {
            $jg = parsekeyword($keyword, parselink(str_replace(array("<", ">"), array("&lt;", "&gt;"), $r['content'])));
        } else {
            $jg = parselink(str_replace(array("<", ">"), array("&lt;", "&gt;"), $r['content']));
        }
        $tags = get_tags($r['tweet_id']);
        if (strstr($r['source'], '<')) {
            $source = str_replace("<a ", '<a target="_blank" class="left microblog-item-position"', $r['source']);
        } else {
            $source = '<a class="left microblog-item-position" target="_blank">' . $r['source'] . '</a>';
        }
        $content .= '<div class="microblog-item" id="' . strtotime($r['post_datetime']) . '">
                    <div class="left microblog-item-pic">
                        <a target="_blank" href="' . BASE_URL . 'profile/' . $r['post_screenname'] . '"><img alt="" width="50" height="50" src="' . $r['profile_image_url'] . '"/></a>
                    </div>
                    <div class="left microblog-item-content">
                        <div class="microblog-item-blog">
                            <a class="microblog-item-blog-name" target="_blank" href="' . BASE_URL . 'profile/' . $r['post_screenname'] . '">' . $r['post_screenname'] . '</a>:' . $jg . '
        </div>';
        if ($r['thumbnail']) {
            $content .= '
                        <div><a onclick="ShowMiddlePic(\'' . str_replace("/thumbnail/", "/bmiddle/", $r['thumbnail']) . '\')"><img src="' . $r['thumbnail'] . '" /></a></div>';
        }
        $content .= '
                        <div class="microblog-item-other">
                            <a target="_blank" href="http://api.t.sina.com.cn/' . $r['user_site_id'] . '/statuses/' . $r['tweet_site_id'] . '" class="left microblog-item-time">' . time_tran($r['post_datetime']) . '</a> ' . $source;
        if ($admin) {
            $content .= '<a class="right item-control last delete" onclick="DeleteTweet(\'' . $r['tweet_id'] . '\', this)">删除</a>';
        } else {
            if (user_is_authenticated()) {
                $fav = 0;
                $app = 0;
                foreach ($allfav as $f) {
                    if ($f['tweet_id'] == $r['tweet_id']) {
                        $fav = 1;
                        break;
                    }
                }
                foreach ($allapp as $f) {
                    if ($f['tweet_id'] == $r['tweet_id']) {
                        $app = 1;
                        break;
                    }
                }
                if (!$fav) {
                    $content .= '<a class="right microblog-item-control like" onclick="JobLike(this,\'' . $r['tweet_id'] . '\')">收藏</a><a class="right microblog-item-control unlike"
                                            style="display: none;" onclick="JobUnLike(this,\'' . $r['tweet_id'] . '\')">取消收藏</a> ';
                } else {
                    $content .= '<a class="right microblog-item-control like" style="display: none;" onclick="JobLike(this,\'' . $r['tweet_id'] . '\')">收藏</a><a class="right microblog-item-control unlike"
                                             onclick="JobUnLike(this,\'' . $r['tweet_id'] . '\')">取消收藏</a> ';
                }
                $role = get_current_user_role();
                if ($role == 1) {
                    if ($r['type'] != 1 and !$app) {
                        $content .= '<a class="right microblog-item-control microblog-item-apply apply" onclick="JobApply(this,\'' . $r['tweet_id'] . '\',\'' . $r['post_screenname'] . '\')">
                                 申请该职位</a><a class="right microblog-item-control microblog-item-apply unapply" style="display: none;" onclick="JobUnApply(this,\'' . $r['tweet_id'] . '\')">
                                 取消申请</a>';
                    } elseif ($app) {
                        $content .= '<a class="right microblog-item-control microblog-item-apply apply" style="display: none;" onclick="JobApply(this,\'' . $r['tweet_id'] . '\',\'' . $r['post_screenname'] . '\')">
                                 申请该职位</a><a class="right microblog-item-control microblog-item-apply unapply" onclick="JobUnApply(this,\'' . $r['tweet_id'] . '\')">
                                 取消申请</a>';
                    }
                }
            }
            if ($tags) {
                $content .= '</div><div class="microblog-item-other1">
                                <span class="left microblog-item-relate">相关职位:</span> ';
                foreach ($tags as $t) {
                    $content .= '<a class="left keyword microblog-item-relate" onclick="SearchContent(false, \'' . $t . '\', 0, 0)">' . $t . '</a>';
                }
            }
        }
        $content .= '
                        </div>
                    </div>
                </div>';
    }
    return $content;
}