169 $com_modified =
null;
176 $com_exparams =
null;
183 if (
'xoopscomment' != strtolower(get_class($comment))) {
186 if (!$comment->isDirty()) {
189 if (!$comment->cleanVars()) {
192 foreach ($comment->cleanVars as $k => $v) {
195 if ($comment->isNew()) {
196 $com_id = $this->db->genId(
'xoopscomments_com_id_seq');
198 'INSERT INTO %s (com_id, com_pid, com_modid, com_icon, com_title, com_text, com_created, com_modified, com_uid, com_ip, com_sig, com_itemid, com_rootid, com_status, com_exparams, dohtml, dosmiley, doxcode, doimage, dobr) VALUES (%u, %u, %u, %s, %s, %s, %u, %u, %u, %s, %u, %u, %u, %u, %s, %u, %u, %u, %u, %u)', $this->db->prefix(
'xoopscomments'), $com_id, $com_pid, $com_modid, $this->db->quoteString($com_icon), $this->db->quoteString($com_title), $this->db->quoteString($com_text), $com_created, $com_modified, $com_uid, $this->db->quoteString($com_ip), $com_sig, $com_itemid, $com_rootid, $com_status, $this->db->quoteString($com_exparams), $dohtml, $dosmiley, $doxcode, $doimage, $dobr);
201 'UPDATE %s SET com_pid = %u, com_icon = %s, com_title = %s, com_text = %s, com_created = %u, com_modified = %u, com_uid = %u, com_ip = %s, com_sig = %u, com_itemid = %u, com_rootid = %u, com_status = %u, com_exparams = %s, dohtml = %u, dosmiley = %u, doxcode = %u, doimage = %u, dobr = %u WHERE com_id = %u', $this->db->prefix(
'xoopscomments'), $com_pid, $this->db->quoteString($com_icon), $this->db->quoteString($com_title), $this->db->quoteString($com_text), $com_created, $com_modified, $com_uid, $this->db->quoteString($com_ip), $com_sig, $com_itemid, $com_rootid, $com_status, $this->db->quoteString($com_exparams), $dohtml, $dosmiley, $doxcode, $doimage, $dobr, $com_id);
203 if (!$result = $this->db->query($sql)) {
206 if (empty($com_id)) {
207 $com_id = $this->db->getInsertId();
209 $comment->assignVar(
'com_id', $com_id);
240 public function &
getObjects($criteria =
null, $id_as_key =
false)
244 $sql =
'SELECT * FROM '.$this->db->prefix(
'xoopscomments');
245 if (isset($criteria) && $criteria instanceof \criteriaelement) {
246 $sql .=
' '.$criteria->renderWhere();
247 $sort = (
'' != $criteria->getSort()) ? $criteria->getSort() :
'com_id';
248 $sql .=
' ORDER BY '.$sort.
' '.$criteria->getOrder();
249 $limit = $criteria->getLimit();
250 $start = $criteria->getStart();
252 $result = $this->db->query($sql, $limit, $start);
256 while ($myrow = $this->db->fetchArray($result)) {
258 $comment->assignVars($myrow);
262 $ret[$myrow[
'com_id']] =& $comment;