} $s_dbr = sprintf('%s limit %d, %d', $s_a_dbr, ($page - 1) * $config['pagesize'], $config['pagesize']); $q_dbr = mysql_query($s_dbr) or die(''); $r_dbr = mysql_fetch_assoc($q_dbr); do { $content .= getpcinfo($r_dbr); } while ($r_dbr = mysql_fetch_assoc($q_dbr)); mysql_free_result($q_dbr); } mysql_free_result($q_a_dbr); $content .= '</ul>'; if (isset($p_dbr) && $p_dbr > 1) { $content .= getpage($page, $p_dbt); } if ($c_log && $r_dbp['disp'] == 0) { $content .= '<div class="title" id="postreply">发表评论</div><div class="lcontent">' . getcform() . '</div>'; } } } else { header('Location:./'); exit; } mysql_free_result($q_dbp); } elseif (isset($_GET['camp']) && intval($_GET['camp']) > 0) { $s_dbc = sprintf('select id, title from %s where id=%s and disp=0 limit 1', $dbprefix . 'camp', intval($_GET['camp'])); $q_dbc = mysql_query($s_dbc) or die(''); $r_dbc = mysql_fetch_assoc($q_dbc); if (mysql_num_rows($q_dbc) > 0) { $s_a_dbp = sprintf('select a.id, a.title, a.url, a.vid, a.upload, a.disp, b.name from %s as a, %s as b where a.cid=%s and a.aid=b.id and a.disp=0 order by a.datetime desc', $dbprefix . 'photo', $dbprefix . 'member', $r_dbc['id']); $q_a_dbp = mysql_query($s_a_dbp) or die(''); $c_dbp = mysql_num_rows($q_a_dbp);
});'; $content .= '</ul>'; if ($p_dbt > 1) { $content .= getpage($page, $p_dbt); } } else { $content .= '<li><div class="title">班级留言</div><div class="lcontent">没有留言</div></li></ul>'; } mysql_free_result($q_a_dbt); $t_topicf = 2; if ($c_log) { $js_c .= ' $("span[name=\'post_link\']").click(function(){ dhdivf(\'topicform\', $(this).data(\'id\'), ' . $t_topicf . '); });'; $content .= '<div class="title">发表留言 <span class="gdate"><span name="post_link" data-id="0" class="mlink f_link">留言</span> | <span name="post_link" data-id="1" class="mlink f_link">投票</span></span></div><div class="lcontent">' . getcform() . '<form method="post" action="" class="btform" id="topicform1" style="display: none;"><table><tr><td>投票标题:</td><td><input name="vtitle" size="32" class="bt_input" rel="投票标题" /></td></tr><tr><td>有效天数:</td><td><input name="vday" size="32" value="0" />天(0或空为不限制)</td></tr><tr><td>投票类型:</td><td><input name="vtype" value="0" type="radio" checked="checked" />单选 <input name="vtype" value="1" type="radio" />多选(发布后不可编辑)</td></tr><tr><td colspan="2">投票选项:每一行为一个选项,发布后不可编辑<br/><textarea name="voption" rows="8" class="bt_input" rel="投票选项"></textarea></td></tr><tr><td colspan="2"><input type="submit" value="发布" class="button" /> <input value="取消" class="button" type="reset" /><input type="hidden" name="mid" value="1"/></td></tr></table></form></div>'; } $content .= '</div></div><div class="lmenu"><ul><li>欢迎您'; if ($c_log) { $s_dbg = sprintf('select id from %s where tid=%s and readed=1', $dbprefix . 'message', $_SESSION[$config['u_hash']]); $q_dbg = mysql_query($s_dbg) or die(''); $c_dbg = mysql_num_rows($q_dbg); mysql_free_result($q_dbg); $content .= ',' . $pn . ' <a href="?m=logout">退出</a><ol><li><a href="?m=message">短消息</a>' . ($c_dbg > 0 ? '(<span class="message_n">' . $c_dbg . '</span>)' : '') . '</li><li><a href="?m=profile">个人资料</a></li>' . ($pa == 9 ? '<li><a href="?m=setting">班级设置</a></li>' : '') . '</ol>'; } else { $content .= '<ol><li><a href="?m=login">登录留言</a></li></ol>'; } $content .= '</li>'; require_once 'lib/lunar.php'; $lunar = new Lunar(); for ($i = 0; $i < 5; $i++) {
function getpcinfo($r) { global $pa, $c_log, $dbprefix, $config; $u = '?m=' . (isset($r['pid']) ? 'album&id=' . $r['pid'] : 'camp&id=' . $r['cid']); $c = '<li class="l_list"><a href="?m=user&id=' . $r['aid'] . '"><img src="avator.php?id=' . $r['aid'] . '" alt="" title="' . $r['name'] . '" class="photo" width="55" height="55"/></a><div class="list_r"><div class="list_title">'; if ($c_log && (!isset($r['sid']) || $r['sid'] == 0)) { if ($pa > $r['power'] || $_SESSION[$config['u_hash']] == $r['aid']) { $cm[] = ' <img src="images/o_3.gif" alt="" title="编辑" name="hs_cbt" data-id="l_' . $r['id'] . '|h_' . $r['id'] . '" class="f_link"/>'; } if ($pa > 0) { $cm[] = ' <img src="images/o_2.gif" alt="" title="删除" name="' . ($pa == 9 ? 'del_list_img' : 's_cbt') . '" data-id="' . ($pa == 9 ? '' : 'del_') . $r['id'] . '" class="f_link"/>'; } if ($pa == 9 && $r['disp'] > 0) { $cm[] = ' <span class="del_n">已删除</span> <a href="' . $u . '&pid=' . $r['id'] . '"><img src="images/o_4.gif" alt="" title="恢复"/></a>'; } } if (isset($cm)) { $c .= '<span class="gmod">' . join(' ', $cm) . '</span>'; } $c .= getalink($r['aid'], $r['name']) . ' <span class="gdate">' . getldate($r['datetime']) . '</span></div><div class="list_c">'; if ($c_log && $pa > 0 && $pa < 9 && (!isset($r['sid']) || $r['sid'] == 0)) { $c .= '<form method="post" action="" class="btform" id="del_' . $r['id'] . '" style="display: none;"><table><tr><td>删除理由:</td><td><input name="rtext" size="32" class="bt_input" rel="删除理由" /></td></tr><tr><td colspan="2"><input type="submit" value="删除" class="button" /> <input value="取消" class="button" type="button" name="h_cbt" data-id="del_' . $r['id'] . '"/><input type="hidden" name="did" value="' . $r['id'] . '" /></td></tr></table></form>'; } $c .= '<div id="l_' . $r['id'] . '">'; if (isset($r['sid']) && $r['sid'] > 0) { $pr = getpinfo($r['sid']); $u = $pr['url']; if ($pr['upload'] == 0) { $tb_i = ''; if (strstr($u, '[/]')) { $a_u = explode('[/]', $u); $l_u = count($a_u) - 1; $t_u = $a_u[$l_u]; if (trim($t_u) != '' && strstr(trim($t_u), '://')) { $tb_i = trim($t_u); unset($a_u[$l_u]); } $u = join('[/]', $a_u); } } if ($pr['vid'] > 0) { $c .= '<img src="' . getthu($pr) . '" width="70" height="70" class="f_link video_slink al_t" alt="" title="观看视频" data-id="' . $r['id'] . '"/><div id="video_div_' . $r['id'] . '"></div><textarea id="video_text_' . $r['id'] . '" style="display: none;">' . htmlspecialchars($u, ENT_QUOTES) . '</textarea><a href="?m=album&id=' . $r['sid'] . '">' . ($pr['title'] != '' ? $pr['title'] : '视频 #' . $pr['id']) . '</a>'; } else { $c .= '<img src="' . getthu($pr) . '" alt="" title="点击查看原图" width="70" height="70" class="f_link img_lb al_t" data-img="' . ($config['slink'] > 0 || $pr['upload'] == 0 ? ($pr['upload'] > 0 ? 'file/' : '') . $u : 'img.php?id=' . $pr['id']) . '"/><br/><a href="?m=album&id=' . $r['sid'] . '">' . ($pr['title'] != '' ? $pr['title'] : '照片 #' . $pr['id']) . '</a>'; } $reply_s = 5; $s_dbr = sprintf('select a.id, a.aid, a.content, a.datetime, b.name from %s as a, %s as b where a.pid=%s and a.aid=b.id and a.disp=0 order by a.datetime desc limit %d', $dbprefix . 'pcomment', $dbprefix . 'member', $r['sid'], $reply_s); $q_dbr = mysql_query($s_dbr) or die(''); $r_dbr = mysql_fetch_assoc($q_dbr); if (mysql_num_rows($q_dbr) > 0) { $c .= '<div id="reply_v_' . $r['id'] . '" class="reply_d">'; do { $c .= '<div class="reply_v"><div id="l_' . $r_dbr['id'] . '">' . getalink($r_dbr['aid'], $r_dbr['name'], 1) . ':' . getaco($r_dbr['content'], $r_dbr['id'], 1) . '</div><div class="reply_i">- ' . getldate($r_dbr['datetime']) . '</div></div>'; } while ($r_dbr = mysql_fetch_assoc($q_dbr)); $c .= '<a href="?m=album&id=' . $r['sid'] . '">更多留言</a></div>'; } mysql_free_result($q_dbr); } else { $c .= getaco($r['content'], $r['id']); } $c .= '</div>'; if ($c_log && ($pa > $r['power'] || $_SESSION[$config['u_hash']] == $r['aid']) && (!isset($r['sid']) || $r['sid'] == 0)) { $c .= getcform($r['id'], $r['content']); } $c .= '</div></div></li>'; return $c; }
} $s_dbr = sprintf('%s limit %d, %d', $s_a_dbr, ($page - 1) * $config['pagesize'], $config['pagesize']); $q_dbr = mysql_query($s_dbr) or die(''); $r_dbr = mysql_fetch_assoc($q_dbr); do { $content .= getpcinfo($r_dbr); } while ($r_dbr = mysql_fetch_assoc($q_dbr)); mysql_free_result($q_dbr); } mysql_free_result($q_a_dbr); $content .= '</ul>'; if (isset($p_dbr) && $p_dbr > 1) { $content .= getpage($page, $p_dbr); } if ($c_log && $r_dbc['disp'] == 0) { $content .= '<div class="title" id="postreply">发表留言 <span class="gdate"><a href="?m=album&ucid=' . $r_dbc['id'] . '#uploadimg">添加照片/视频</a></span></div><div class="lcontent">' . getcform() . '</div>'; } } } else { header('Location:./'); exit; } mysql_free_result($q_dbc); } else { if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($c_log) { $title = htmlspecialchars(trim($_POST['title']), ENT_QUOTES); $cont = htmlspecialchars(trim($_POST['rinfo']), ENT_QUOTES); $cdate = htmlspecialchars(trim($_POST['cdate']), ENT_QUOTES); $cloc = htmlspecialchars(trim($_POST['cloc']), ENT_QUOTES); $cpay = htmlspecialchars(trim($_POST['cpay']), ENT_QUOTES);
if ($_SERVER['REQUEST_METHOD'] == 'POST') { $cont = htmlspecialchars(trim($_POST['rinfo']), ENT_QUOTES); if ($cont != '') { $i_db = sprintf('insert into %s (content, aid, tid, datetime, readed) values (%s, %s, %s, %s, 1)', $dbprefix . 'message', SQLString($cont, 'text'), $_SESSION[$config['u_hash']], $tid, time()); $result = mysql_query($i_db) or die(''); } header('Location:./?m=message&id=' . $tid); exit; } else { if (isset($_GET['did'])) { $d_db = sprintf('delete from %s where id=%s and aid=%s and tid=%s', $dbprefix . 'message', intval($_GET['did']), $tid, $_SESSION[$config['u_hash']]); $result = mysql_query($d_db) or die(''); header('Location:./?m=message&id=' . $tid); exit; } $content .= '<div class="title" id="send">发消息 - 收件人:' . $tn['name'] . '</div><div class="lcontent">' . getcform() . '</div>'; $s_a_dbg = sprintf('select * from %s where (aid=%s and tid=%s) or (tid=%s and aid=%s) order by datetime desc', $dbprefix . 'message', $tid, $_SESSION[$config['u_hash']], $tid, $_SESSION[$config['u_hash']]); $q_a_dbg = mysql_query($s_a_dbg) or die(''); $c_dbg = mysql_num_rows($q_a_dbg); if ($c_dbg > 0) { $content .= '<div class="title" id="history">聊天记录</div>'; $p_dbg = ceil($c_dbg / $config['pagesize']); if ($page > $p_dbg) { $page = $p_dbg; } $s_dbg = sprintf('%s limit %d, %d', $s_a_dbg, ($page - 1) * $config['pagesize'], $config['pagesize']); $q_dbg = mysql_query($s_dbg) or die(''); $r_dbg = mysql_fetch_assoc($q_dbg); $js_c .= ' $("img[name=\'del_img\']").click(function(){ if(confirm(\'确认要删除?\'))location.href=\'?m=message&id=' . $tid . '&did=\'+$(this).data(\'id\');