query($q); Memc::flush(); } function addSignatureComment($id, $text) { global $S; $q = kl_str_sql("insert into comment (signature_id, user_id, comment) values (!i, !i, !s)", $id, $S->user_id, $text); DBH::$db->query($q); self::updateCommentCount($id); } function getSignatureComments($id) { $ret = array(); $q = kl_str_sql("select c.*, u.name, u.email from comment c join users u on c.user_id = u.user_id where signature_id=!i order by id asc;", $id); if (!$res = DBH::$db->query($q)) return; while ($row = DBH::$db->fetchRow($res)) { $c = new stdClass; DBH::$db->loadFromDbRow($c, $res, $row); $ret[] = $c; } return $ret; } function delSignatureComment($id, $del_id) { $q = kl_str_sql("delete from comment where id=!i", $del_id); DBH::$db->query($q); self::updateCommentCount($id); } function renderComments($id) { global $S; $comments = self::getSignatureComments($id); foreach($comments as $c): $from = $c->name . " <" . $c->email . ">" . " " . date("r", $c->commented); $comment = Markdown::defaultTransform($c->comment); $del = ""; if ($S->user->is_admin || $S->user_id == $c->user_id) { $del = "id}\">Delete comment "; } $gid = md5($c->email); $avatar = (USE_SSL ? "https://secure.gravatar.com" : "http://www.gravatar.com") . "/avatar/$gid?r=x&d=mm&s=48"; ?>
Comments for crash signature