lib = $lib; $this->db = $this->lib->game->db; } function run($a, $post, $sub, $txt, $ec, $es) { $tm = time(); $fid = $post['fid']; $tid = $post['tid']; $pid = $post['id']; $qs = "INSERT INTO f_post(forum,topic,reply_to,author,moment,title,contents,enable_code,enable_smileys) VALUES (" . "$fid,$tid,$pid,$a,$tm,'".addslashes($sub)."','".addslashes($txt)."'," . dbBool($ec) . "," . dbBool($es) . ")"; if (!$this->db->query($qs)) { return false; } $q = $this->db->query("SELECT id FROM f_post WHERE topic=$tid AND reply_to=$pid AND author=$a AND moment=$tm ORDER BY id DESC LIMIT 1"); if (!$q || dbCount($q) != 1) { return false; } list($pid) = dbFetchArray($q); $this->db->query("UPDATE f_topic SET last_post=$pid WHERE id=$tid"); $this->db->query("UPDATE f_forum SET posts=posts+1,last_post=$pid WHERE id=$fid"); $this->lib->call('markUnread', $tid,$a); return $pid; } } ?>