Exemple #1
0
function wapli($content_id, $user_id, $user_nickname, $content, $posttime, $type, $from, $status_id, $status_uname, $status_unickname, $showspeaker, $isprivate = 0)
{
    global $user;
    $delmsgbtn = $speaker = '';
    if ($user_id == $user[user_id]) {
        $delmsgbtn = " <a href='index.php?op=home&act=delmsg&sid={$content_id}&from=" . urlencode($from) . "'>删除</a>";
    }
    if ($showspeaker == 1) {
        $speaker = "<a href='index.php?op=home&uid={$user_id}'>{$user_nickname}</a> ";
    }
    if ($isprivate == 1) {
        $private = "";
    } else {
        $private = "<a href='index.php?op=reply&status_id={$content_id}'>回复</a> <a href='index.php?op=shoucang&sid={$content_id}'>收藏</a>";
    }
    if ($status_id && $status_uname) {
        $isstatus = '对' . $status_unickname . '的回复&nbsp;';
    } else {
        $isstatus = '&nbsp;';
    }
    return "<li>{$speaker}" . wapreplace($content) . " <span class='stamp'>" . timeop($posttime) . " 通过{$type}{$isstatus}{$private}{$delmsgbtn}</span></li>";
}
        echo "ºÜ±§Ç¸£¬É¾³ýÆÀÂÛʧ°ÜÁË£¬";
        exit;
    }
}
$i = 0;
$start = ($page - 1) * $home_num;
$sql = "SELECT r.*,u.user_id,u.user_name,u.user_head FROM et_users AS u,et_sharereply AS r where r.user_id=u.user_id && r.share_id='{$sid}' order by r.shre_id desc limit {$start},{$home_num}";
$query = $db->query($sql);
while ($data = $db->fetch_array($query)) {
    $i = $i + 1;
    $shre_id = $data['shre_id'];
    $reuid = $data['user_id'];
    $reuname = $data['user_name'];
    $reuhead = $data['user_head'] ? "{$webaddr}/attachments/head/" . $data['user_head'] : "{$webaddr}/images/noavatar.jpg";
    $reply_body = ubb($data['reply_body']);
    $reply_time = timeop($data['reply_time']);
    $reply[] = array("shre_id" => $shre_id, "reuid" => $reuid, "reuname" => $reuname, "reuhead" => $reuhead, "reply_body" => $reply_body, "reply_time" => $reply_time);
}
$query = $db->query("select count(*) as count from et_sharereply where share_id='{$sid}'");
$row = $db->fetch_array($query);
$total = $row['count'];
$pg_num = $total / $index_num;
$pg_num = intval($pg_num);
if ($total != $pg_num * $index_num) {
    $pg_num = $pg_num + 1;
}
$np = $page + 1;
$pp = $page - 1;
if ($pg_num > 8) {
    if ($pg_num - $page <= 6) {
        $page_from = $page - 1 == 0 ? 1 : $pg_num - 7;
//查询
$start = ($page - 1) * 10;
if ($pmtp == "my") {
    $sql = "SELECT * FROM et_messages WHERE sendtouid='{$user['user_id']}' order by message_id desc limit {$start},10";
} else {
    $sql = "SELECT * FROM et_messages WHERE senduid='{$user['user_id']}' order by message_id desc limit {$start},10";
}
$query = $db->query($sql);
while ($data = $db->fetch_array($query)) {
    $messagebody = wapreplace($data['messagebody']);
    if ($pmtp == "my") {
        echo "<li>来自:";
    } else {
        echo "<li>发给:";
    }
    echo "<a href='index.php?op=home&uid={$data[senduid]}'>{$data[sendnickname]}</a> {$messagebody} <span class='stamp'>" . timeop($data['sendtime']) . " <a href='index.php?op=privatemsg&act=delpmsg&mid={$data[message_id]}'>删除</a></span></li>";
}
echo "</ul>";
//分页
if ($pmtp == "my") {
    $total = getcount('et_messages', array('sendtouid' => $user[user_id]));
} else {
    $total = getcount('et_messages', array('senduid' => $user[user_id]));
}
$pg_num = ceil($total / 10);
if ($pg_num > 1) {
    echo "<div class='page'>";
    if ($page - 1 > 0) {
        echo "<a href='index.php?op=privatemsg&pmtp={$pmtp}&page=" . ($page - 1) . "'>上页</a>&nbsp;";
    }
    if ($page + 1 <= $pg_num) {
    $start = ($page - 1) * $index_num;
    $query = $db->query("SELECT * FROM et_content WHERE privacy=0 && replyshow=1 ORDER BY posttime DESC LIMIT {$start},{$index_num}");
    while ($data = $db->fetch_array($query)) {
        $indexnum++;
        $content[] = array('content_id' => $data['content_id'], 'user_id' => $data['user_id'], 'user_name' => $data['user_name'], 'user_nickname' => $data['user_nickname'], 'user_head' => $data['user_head'], 'content_body' => ubb($data['content_body']), 'posttime' => timeop($data['posttime']), 'type' => $data['type'], 'status_id' => $data['status_id'], 'status_uname' => $data['status_uname'], 'status_unickname' => $data['status_unickname'], 'replytimes' => $data['replytimes'], 'zftimes' => $data['zftimes']);
    }
    echo loadindex($content);
    exit;
}
//新信息
if ($act == 'getupdate') {
    $lastid = $_GET['lastid'];
    if ($lastid > 0) {
        $query = $db->query("SELECT * FROM et_content WHERE privacy=0 && replyshow=1 && content_id>'{$lastid}'");
        while ($data = $db->fetch_array($query)) {
            $content[] = array('content_id' => $data['content_id'], 'user_id' => $data['user_id'], 'user_name' => $data['user_name'], 'user_nickname' => $data['user_nickname'], 'user_head' => $data['user_head'], 'content_body' => ubb($data['content_body']), 'posttime' => timeop($data['posttime']), 'type' => $data['type'], 'status_id' => $data['status_id'], 'status_uname' => $data['status_uname'], 'status_unickname' => $data['status_unickname'], 'replytimes' => $data['replytimes'], 'zftimes' => $data['zftimes']);
        }
    }
    echo loadindex($content);
    exit;
}
//上榜
$query = $db->query("SELECT user_name,nickname,user_head FROM et_users WHERE indextop=1 ORDER BY rand() LIMIT 7");
while ($data = $db->fetch_array($query)) {
    $data['user_head'] = $data['user_head'] ? "{$webaddr}/attachments/head/" . $data['user_head'] : "{$webaddr}/images/noavatar.jpg";
    $indextop[] = array('user_name' => $data['user_name'], 'nickname' => $data['nickname'], 'user_head' => $data['user_head']);
}
//在线用户 放入memcache 半小时更新
$query = $db->query("SELECT user_id,user_name,nickname,user_head FROM et_users WHERE last_login>='" . ($addtime - 600) . "' ORDER BY last_login DESC LIMIT 12");
while ($data = $db->fetch_array($query)) {
    $uhead = $data[user_head] ? "{$webaddr}/attachments/head/" . $data[user_head] : "{$webaddr}/images/noavatar.jpg";
    $rnum = 0;
    $query = $db->query("SELECT * FROM et_content WHERE status_id='{$cid}' ORDER BY content_id");
    while ($data = $db->fetch_array($query)) {
        $rep = '';
        $rnum++;
        if ($my['user_id'] && $my['user_id'] != $data['user_id']) {
            $rep = "<a href='javascript:void(0)' style='float:right' onclick=\"replyajaxin('{$cid}','{$data[user_nickname]}')\">回复</a>";
        }
        if ($my['user_id'] && $my['user_id'] == $data['user_id']) {
            $rep = '<a href="javascript:void(0)" style="float:right" onclick="delmsg(\'' . $webaddr . '/index.php?act=del&cid=' . $data[content_id] . '\',\'确实要删除此条TALK吗?\',this.parentNode.parentNode.parentNode.parentNode)">删除</a>';
        }
        $content = ubb($data['content_body']);
        $replys[] = '<li class="lire">
        <div class="images"><a href="' . $webaddr . '/' . $data['user_name'] . '"><img src="' . $data['user_head'] . '" width="30px"></a></div>
        <div class="info">
            <p><a class="username" href="' . $webaddr . '/' . $data['user_name'] . '">' . $data['user_nickname'] . '</a><span class="setgray">' . timeop($data['posttime']) . '&nbsp;' . $rep . '</span></p>
            <p>' . $content . '</p>
        </div>
        </li>';
    }
    $replynums = count($replys);
    $replyshow = implode(' ', $replys);
    if ($replynums > 5) {
        $allreply = '<div id="all_' . $cid . '" style="display:none">' . $replyshow . '</div>';
        $showall = '<li style="padding-bottom:0px"><a href="##" onclick="showallreply(\'' . $cid . '\')">显示中间 ' . ($replynums - 4) . ' 条消息</a></li>' . $allreply;
        $replyshow = $replys[0] . $replys[1] . $showall . $replys[$replynums - 2] . $replys[$replynums - 1];
    }
    echo '<ul class="reply_list_ul"><span id="showall_' . $cid . '">' . $replyshow . '</span></ul>';
    $contDT = $db->fetch_array($db->query("SELECT * FROM et_content WHERE content_id='{$cid}'"));
    ?>
<table border="0" width="100%">
Exemple #6
0
 public function getcontent()
 {
     if (Action::$site_info['pubusersx'] == 1) {
         $condition = " AND user_head!='' AND live_city!='' AND live_city!='其他 其他' AND user_gender!='' AND user_info!='' AND auth_email='1'";
     } else {
         $condition = " AND live_city!='' AND live_city!='其他 其他'";
     }
     $lasttime = $_GET['lasttime'];
     $content = D('ContentView')->where('replyid=0' . $condition . ' AND posttime>' . $lasttime)->order("`content_id` DESC")->limit('30')->select();
     if ($content) {
         foreach ($content as $key => $val) {
             $result1[] = str_replace('海外 ', '', $val['live_city']);
             $result2[] = sethead($val['user_head']);
             $result3[] = "<div class=\"maps\"><a href=\"" . SITE_URL . "/{$val['user_name']}\" title=\"{$val['nickname']}\" target=\"_blank\" class=\"link\"><img src=\"" . sethead($val['user_head']) . "\" alt=\"{$val['nickname']}\"/></a><span class=\"body\"><span class=\"nickname " . setvip($val['user_auth']) . "\"><a href=\"" . SITE_URL . "/{$val['user_name']}\" title=\"{$val['nickname']}\" target=\"_blank\">{$val['nickname']}</a></span> " . daddslashes(D('Content')->ubb($val['content_body'])) . "<div class=\"other\">" . timeop($val['posttime']) . " {$val['live_city']}</div></span></div>";
             $lasttime = max($val['posttime'], $lasttime);
         }
         echo json_encode(array('res' => 'success', 'result1' => $result1, 'result2' => $result2, 'result3' => $result3, 'lasttime' => $lasttime));
     }
 }
        wapfooter();
        exit;
    }
}
//页面生成
echo "<h2>你在做什么?</h2>" . "<form method=\"post\" action=\"index.php\">" . "<p><input type=\"text\" name=\"cbody\" value=\"\" maxlength=\"140\" /></p>" . "<p><input type=\"hidden\" name=\"action\" value=\"post\" /><input type=\"submit\" value=\"发送\" /></p>" . "</form>" . "<h2>最新消息(<a href='index.php'>刷新</a>) | <a href='index.php?op=myfriends'>关注动态</a></h2>" . "<ul>";
$start = ($page - 1) * 10;
$query = $db->query("SELECT s.content_id,s.content_body,s.posttime,s.type,s.status_id,s.status_uname,s.status_type,u.user_id,u.user_name FROM et_content AS s,et_users AS u where s.user_id=u.user_id && s.user_id='{$user_id}' order by s.content_id desc limit {$start},10");
while ($data = $db->fetch_array($query)) {
    $content_id = $data['content_id'];
    $content_uid = $data['user_id'];
    $content_uname = $data['user_name'];
    $content_body = $data['content_body'];
    $content_body = str_replace("home/u.", "wap/index.php?op=home&uid=", $content_body);
    $content_body = urlreplace($content_body);
    $posttime = timeop($data['posttime']);
    $content_type = $data['type'];
    $statusid = $data['status_id'];
    $status_uname = $data['status_uname'];
    $status_type = $data['status_type'];
    if ($status_type == "talk") {
        echo "<li><a href='index.php?op=home&uid={$content_uid}'>{$content_uname}</a> {$content_body} <span class=\"stamp\">{$posttime} 通过" . $content_type . "给" . $status_uname . "的回复 <a href=\"index.php?act=delshare&sid={$content_id}\">删除</a></span></li>";
    } else {
        if ($status_type == "photo") {
            echo "<li><a href='index.php?op=home&uid={$content_uid}'>{$content_uname}</a> {$content_body} <span class=\"stamp\">{$posttime} 通过" . $content_type . "给" . $status_uname . "相片的回复 <a href=\"index.php?act=delshare&sid={$content_id}\">删除</a></span></li>";
        } else {
            echo "<li><a href='index.php?op=home&uid={$content_uid}'>{$content_uname}</a> {$content_body} <span class=\"stamp\">{$posttime} 通过{$content_type} <a href=\"index.php?act=delshare&sid={$content_id}\">删除</a></span></li>";
        }
    }
}
echo "</ul>";
tologin();
if ($action == 'follow') {
    $follow = $_POST['follow'];
    $follownew = array();
    for ($i = 0; $i < count($follow); $i++) {
        $isfriend = isfriend($follow[$i], $my[user_id]);
        if ($isfriend == 0 && $follow[$i] != $my[user_id]) {
            $follownew[] = $follow[$i];
        }
    }
    if ($follownew) {
        for ($j = 0; $j < count($follownew); $j++) {
            $db->query("INSERT INTO et_friend  (fid_jieshou,fid_fasong) VALUES ('{$follownew[$j]}','{$my['user_id']}')");
            frinum($my[user_id]);
            frinum($follownew[$j]);
        }
    }
    header("location: {$webaddr}/op/setting");
    exit;
}
$query = $db->query("SELECT * FROM et_users WHERE user_id=1 || (followme_num>0 && lastconttime>0) ORDER BY followme_num DESC LIMIT 10");
while ($data = $db->fetch_array($query)) {
    $uhead = $data['user_head'] ? "{$webaddr}/attachments/head/" . $data['user_head'] : "{$webaddr}/images/noavatar.jpg";
    $follows[] = array('user_id' => $data['user_id'], 'user_name' => $data['user_name'], 'nickname' => $data['nickname'], 'user_head' => $uhead, 'lastcontent' => ubb($data['lastcontent']), 'lastconttime' => timeop($data['lastconttime']), 'followme_num' => $data['followme_num'], 'msg_num' => $data['msg_num']);
}
//模板和Foot
$web_name3 = "新来乍到";
$sqlnum = $db->querynum;
$mtime = explode(' ', microtime());
$loadtime = $mtime[1] + $mtime[0] - $starttime;
include $template->getfile('op_guide.htm');
define('is_admin_path', 'yes');
include '../common.inc.php';
if ($admin_login != "yes" || $my[isadmin] != 1) {
    header("Location: login.php");
}
if ($action == 'del') {
    $rpid = $_POST["rpid"];
    $db->query("DELETE FROM et_report WHERE id='{$rpid}'");
    header("location: report.php");
}
$query = $db->query("SELECT * FROM et_report ORDER BY id DESC");
while ($data = $db->fetch_array($query)) {
    if ($data['reporttype'] == 1) {
        $type = "涉及黄色和暴力";
    } else {
        if ($data['reporttype'] == 2) {
            $type = "政治反动";
        } else {
            if ($data['reporttype'] == 3) {
                $type = "内容侵权";
            } else {
                if ($data['reporttype'] == 4) {
                    $type = "其他不良信息";
                }
            }
        }
    }
    $rept[] = array('id' => $data['id'], 'user_name' => $data['user_name'], 'reporttype' => $type, 'reportbody' => $data['reportbody'], 'dateline' => timeop($data['dateline']));
}
include $template->getfile('report.htm');
    exit;
}
$i = 0;
$start = ($page - 1) * $home_num;
if ($pm == "my") {
    $sql = "SELECT * FROM et_messages WHERE sendtouid='{$my['user_id']}' order by message_id desc limit {$start},{$home_num}";
} elseif ($pm == "send") {
    $sql = "SELECT * FROM et_messages WHERE senduid='{$my['user_id']}' order by message_id desc limit {$start},{$home_num}";
}
$query = $db->query($sql);
while ($data = $db->fetch_array($query)) {
    $i++;
    $sendhead = $data['sendhead'] ? $data['sendhead'] : "{$webaddr}/images/noavatar.jpg";
    $messagebody = ubb($data['messagebody']);
    $isread = $data['isread'] ? 1 : 2;
    $mymsg[] = array("message_id" => $data['message_id'], "senduid" => $data['senduid'], "sendname" => $data['sendname'], "sendnickname" => $data['sendnickname'], "sendhead" => $sendhead, "messagebody" => $messagebody, "sendtouid" => $data['sendtouid'], "sendtoname" => $data['sendtoname'], "sendtonickname" => $data['sendtonickname'], "sendtime" => timeop($data['sendtime']), "isread" => $isread);
}
if ($my['priread'] != 0) {
    $db->query("UPDATE et_users SET priread = 0 WHERE user_id='{$my['user_id']}'");
    $db->query("UPDATE et_messages SET isread = 1 WHERE sendtouid='{$my['user_id']}'");
}
if ($pm == "my") {
    $total = getcount('et_messages', array('sendtouid' => $my[user_id]));
} elseif ($pm == "send") {
    $total = getcount('et_messages', array('senduid' => $my[user_id]));
}
$pg_num = ceil($total / $home_num);
//模板和Foot
$web_name3 = '我的私信';
$menu = 'privatemsg';
$sqlnum = $db->querynum;
        $db->query("UPDATE et_users SET photo_num=photo_num+'1' where user_id='{$my['user_id']}'");
        echo "<script>alert('照片上传成功了!');location.href='{$webaddr}/op/viewalbum/{$alid}'</script>";
        exit;
    }
}
$i = 0;
$start = ($page - 1) * 16;
$sql = "SELECT pt_id,user_id,pt_name,pt_title,uploadtime FROM et_photos where al_id='{$alid}' order by pt_id desc limit {$start},16";
$query = $db->query($sql);
while ($data = $db->fetch_array($query)) {
    $i = $i + 1;
    $pt_id = $data['pt_id'];
    $user_id = $data['user_id'];
    $pt_name = $data['pt_name'];
    $pt_title = $data['pt_title'];
    $time = timeop($data['uploadtime']);
    $photo[] = array("pt_id" => $pt_id, "user_id" => $user_id, "pt_name" => $pt_name, "pt_title" => $pt_title, "time" => $time);
}
$query = $db->query("select count(*) as count from et_photos where al_id='{$alid}'");
$row = $db->fetch_array($query);
$total = $row['count'];
$pg_num = $total / 16;
$pg_num = intval($pg_num);
if ($total != $pg_num * 16) {
    $pg_num = $pg_num + 1;
}
$np = $page + 1;
$pp = $page - 1;
if ($pg_num > 8) {
    if ($pg_num - $page <= 6) {
        $page_from = $page - 1 == 0 ? 1 : $pg_num - 7;
                } else {
                    if ($data['fbtype'] == 4) {
                        $fbtype = "修改昵称";
                    } else {
                        if ($data['fbtype'] == 5) {
                            $fbtype = "错误报告";
                        } else {
                            if ($data['fbtype'] == 6) {
                                $fbtype = "建 议";
                            } else {
                                if ($data['fbtype'] == 7) {
                                    $fbtype = "其它问题";
                                }
                            }
                        }
                    }
                }
            }
        }
        $feedback[] = array("id" => $data['id'], "fbuname" => $data['uname'], "fbunickname" => $data['unickname'], "fbuhead" => $uhead, "fbtype" => $fbtype, "fbbody" => $data['fbbody'], "fbcontect" => $data['contect'], "dataline" => timeop($data['dataline']));
    }
    $query = $db->query("SELECT count(*) AS count FROM et_feedback");
    $row = $db->fetch_array($query);
    $pg_num = ceil($row['count'] / 10);
}
//模板和Foot
$web_name3 = "意见反馈";
$sqlnum = $db->querynum;
$mtime = explode(' ', microtime());
$loadtime = $mtime[1] + $mtime[0] - $starttime;
include $template->getfile('op_feedback.htm');
        $db->query("INSERT INTO et_messages (senduid,sendname,sendnickname,sendhead,sendtouid,sendtoname,sendtonickname,messagebody,sendtime) VALUES ('{$my['user_id']}','{$my['user_name']}','{$my['nickname']}','{$my['user_head']}','{$user['user_id']}','{$user['user_name']}','{$user['nickname']}','{$content}','{$addtime}')");
        echo 'success';
        exit;
    } else {
        echo '您没有填写发送的内容,返回重新填写';
        exit;
    }
}
if ($act == 'getuserinfo') {
    $uid = $_GET['uid'];
    $class = $_GET['class'];
    $userquery = $db->query("SELECT nickname,user_head,lastcontent,lastconttime FROM et_users WHERE user_id='{$uid}'");
    $user = $db->fetch_array($userquery);
    $head = $user['user_head'] ? "{$webaddr}/attachments/head/" . $user['user_head'] : "{$webaddr}/images/noavatar.jpg";
    $content = simplecontent($user[lastcontent]);
    $time = $user[lastconttime] ? timeop($user[lastconttime]) : "";
    echo '<div class="' . $class . '"></div><table width="200" border="0" cellpadding="0" cellspacing="0"><tr><td width="53" rowspan="2" align="left" valign="top"><img src="' . $head . '" width="48px" /></td><td><strong>' . $user[nickname] . ':</strong>' . emotionrp($content) . '</td></tr><tr><td class="followtime">' . $time . "</td></tr></table>";
    exit;
}
if ($act == 'getreplycontent') {
    $contid = $_GET['contid'];
    $contdata = getReply($contid);
    if ($contdata) {
        $contents = ubb($contdata['content_body']);
        echo '<div class="status_reply_list">
            <div class="top"></div>
            <div class="cont">
            <h1 class="line">以下是原文:<a href="' . $webaddr . '/op/view/' . $contid . '">原文回复(' . $contdata['replytimes'] . ')</a></h1>
            <div class="replyajaxbox"><a href="' . $webaddr . '/' . $contdata['user_name'] . '">' . $contdata['user_nickname'] . '</a>:' . $contents . '</div>
            </div>
            <div class="bottom"></div>
$start = ($page - 1) * $home_num;
if ($tp == "all") {
    $sql = "SELECT s.*,u.user_id,u.user_name,u.user_head FROM et_users AS u,et_share AS s where s.user_id=u.user_id && s.type!='' {$ad} order by s.share_id desc limit {$start},{$home_num}";
} else {
    $sql = "SELECT s.*,u.user_id,u.user_name,u.user_head FROM et_users AS u,et_share AS s where s.user_id=u.user_id && s.type='{$tp}' && s.type!='' {$ad} order by s.share_id desc limit {$start},{$home_num}";
}
$query = $db->query($sql);
while ($data = $db->fetch_array($query)) {
    $i = $i + 1;
    $share_id = $data['share_id'];
    $share_uid = $data['user_id'];
    $share_uname = $data['user_name'];
    $share_uhead = $data['user_head'] ? "{$webaddr}/attachments/head/" . $data['user_head'] : "{$webaddr}/images/noavatar.jpg";
    $link_data = unserialize(base64_decode($data['link_data']));
    $content = $data['content'];
    $sharetime = timeop($data['sharetime']);
    $type = $data['type'];
    $retimes = $data['retimes'];
    if ($type == "video") {
        $typedc = "ÊÓƵ";
    } else {
        if ($type == "music") {
            $typedc = "ÒôÀÖ";
        } else {
            if ($type == "flash") {
                $typedc = "Flash";
            } else {
                if ($type == "website") {
                    $typedc = "ÍøÖ·";
                } else {
                    if ($type == "picture") {