} } } if ($count) { $values = $tree->getChilds(); foreach ($values as $key => $vid) { $one = $tree->getValue($vid); $one['layer'] = $tree->getLayer($vid) * 2; $one['style'] = "padding-left:{$one['layer']}em;"; if ($one['id'] == $highlight && $one['uid'] == $space['uid']) { $one['style'] .= 'color:red;font-weight:bold;'; } $list[] = $one; } } $isComplain = isComplainOrNot($doid, $_SGLOBAL['db']); realname_get(); } elseif ($_GET['op'] == 'edit') { if (submitcheck('editsubmit')) { if ($id) { $allowmanage = checkperm('managedoing'); $message = getstr($_POST['new_message'], 480, 1, 1, 1); //Ìæ»»±íÇé if (preg_match("/\\[em:(\\d+):]/is")) { showmessage("Ç×£¬ÔÁÂÎÒÃDz»¹ÄÀøÄú¼ÌÐøʹÓþɱíÇ飬^_^", "location.href=-1"); } $message = preg_replace("/\\[am:(\\d+):]/is", "<img src=\"image/face_new/face_1/\\1.gif\" class=\"face\">", $message); $message = preg_replace("/\\<br.*?\\>/is", ' ', $message); $message = preg_replace("/\\[bm:(\\d+):]/is", "<img src=\"image/face_new/face_2/\\1.gif\" class=\"face\">", $message); $message = preg_replace("/\\<br.*?\\>/is", ' ', $message); if (strlen($message) < 1) {
$query = $_SGLOBAL['db']->query("SELECT dateline FROM " . tname('feed') . " WHERE feedid = {$version}"); $time = current($_SGLOBAL['db']->fetch_array($query)); $query = $_SGLOBAL['db']->query("SELECT COUNT(*) FROM " . tname('feed') . " WHERE {$wheresql} AND dateline > {$time}"); echo current($_SGLOBAL['db']->fetch_array($query)); exit; } elseif ($_GET['op'] == 'upvote') { $feedid = empty($_GET['feedid']) ? 0 : intval($_GET['feedid']); if ($feedid) { $me = intval($_SGLOBAL['supe_uid']); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('feed') . " WHERE feedid=" . $feedid . ' limit 1'); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $upvotes = intval($value['upvotes']); $uid = intval($value['uid']); $upvoters = $value['upvoters']; $blogid = intval($value['id']); if ($value['icon'] == 'doing' && isComplainOrNot($value['id'], $_SGLOBAL['db'])) { echo '-1'; exit; } $icon2name = array('doing' => '足迹', 'album' => '照片', 'poll' => '投票', 'blog' => '日志', 'share' => '分享'); $needle = ',' . $me . ','; if (!$upvoters && $me != $uid) { $upvoters = $needle; $_SGLOBAL['db']->query("UPDATE " . tname('feed') . " SET upvotes=upvotes+1, upvoters='" . $upvoters . "' WHERE feedid=" . $feedid); if ($_SGLOBAL['db']->query("SELECT * from " . tname('feed') . " WHERE feedid=" . $feedid . " AND idtype='blogid'")) { $_SGLOBAL['db']->query("UPDATE " . tname('blog') . " blog, " . tname('feed') . " feed SET blog.click_4 = blog.click_4 + 1 WHERE feed.feedid=" . $feedid . " AND blog.blogid=feed.id"); } $q = $_SGLOBAL['db']->query("SELECT username, name from " . tname('space') . " where uid=" . $me); $data = $_SGLOBAL['db']->fetch_array($q); $name = $data['name'] ? $data['name'] : $data['username']; $setarr = array('uid' => $uid, 'type' => "systemnote", 'new' => 1, 'authorid' => $me, 'author' => $name, 'note' => '赞了你的<a href="space.php?do=feeddetail&feedid=' . $feedid . '">动态</a>', 'dateline' => $_SGLOBAL['timestamp']);
function canUpvote($me, $feed) { global $_SGLOBAL; $me = intval($me); $uid = intval($feed['uid']); $upvoters = $feed['upvoters']; if ($feed['icon'] == 'doing' && isComplainOrNot($feed['id'], $_SGLOBAL['db'])) { return 0; } if (!$upvoters && $me != $uid) { return 1; } $needle = ',' . $me . ','; if ($me == $uid || strrpos($upvoters, $needle) !== false) { return 0; } return 1; }
$theurl .= "&doid={$doid}"; } $doids = $clist = $newdoids = array(); if (empty($count)) { $count = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM " . tname('doing') . " WHERE {$wheresql}"), 0); //更新统计 if ($wheresql == "uid='{$space['uid']}'" && $space['doingnum'] != $count) { updatetable('space', array('doingnum' => $count), array('uid' => $space['uid'])); } } if ($count) { $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('doing') . " {$f_index}\r\n\t\tWHERE {$wheresql}\r\n\t\tORDER BY dateline DESC\r\n\t\tLIMIT {$start},{$perpage}"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { realname_set($value['uid'], $value['username']); $doids[] = $value['doid']; $value['isComplain'] = isComplainOrNot($value['doid'], $_SGLOBAL['db']); $dolist[] = $value; } } //单条处理 if ($doid) { $dovalue = empty($dolist) ? array() : $dolist[0]; if ($dovalue) { if ($dovalue['uid'] == $_SGLOBAL['supe_uid']) { $actives = array('me' => ' class="active"'); } else { $space = getspace($dovalue['uid']); //对方的空间 $actives = array('all' => ' class="active"'); } }