id = intval($flag_id); if (!$this->id) { return false; } $info = $this->_get_info(); $this->user = $info['user']; $this->object_id = $info['object_id']; $this->object_type = $info['object_type']; $this->comment = $info['comment']; $this->flag = $info['flag']; return true; } // flag /** * _get_info * Private function for getting the information for this object from the database */ function _get_info() { $id = sql_escape($this->id); $sql = "SELECT * FROM flagged WHERE id='$id'"; $db_results = mysql_query($sql, dbh()); $results = mysql_fetch_assoc($db_results); return $results; } // _get_info /** * add * This adds a flag entry for an item, it takes an id, a type, the flag type * and a comment and then inserts the mofo */ function add($id,$type,$flag,$comment) { $id = sql_escape($id); $type = sql_escape($type); $flag = sql_escape($flag); $comment = sql_escape($comment); $sql = "INSERT INTO flagged (`object_id`,`object_type`,`flag`,`comment`) VALUES " . " ('$id','$type','$flag','$comment')"; $db_results = mysql_query($sql, dbh()); return true; } // add } //end of flag class ?>