/** * Update * * @param XoopsComment $comment {@link XoopsComment} object * @param string $field_name Name of the field * @param mixed $field_value Value to write * * @return bool **/ public function updateByField(XoopsComment $comment, $field_name, $field_value) { $comment->unsetNew(); $comment->setVar($field_name, $field_value); return $this->insert($comment); }
/** * Create a responce comment object, and return it. * @return XoopsComment */ function &createChild() { $ret = new XoopsComment(); $ret->setNew(); $ret->setVar('com_pid', $this->getVar('com_id')); $ret->setVar('com_rootid', $this->getVar('com_rootid')); $ret->setVar('com_modid', $this->getVar('com_modid')); $ret->setVar('com_itemid', $this->getVar('com_itemid')); $ret->setVar('com_exparams', $this->getVar('com_exparams')); $title = $this->get('com_title'); if (preg_match("/^Re:(.+)\$/", $title, $matches)) { $ret->set('com_title', "Re[2]: " . $matches[1]); } elseif (preg_match("/^Re\\[(\\d+)\\]:(.+)\$/", $title, $matches)) { $ret->set('com_title', "Re[" . ($matches[1] + 1) . "]: " . $matches[2]); } elseif (!preg_match("/^re:/i", $title)) { $ret->set('com_title', "Re: " . xoops_substr($title, 0, 56)); } else { $ret->set('com_title', $title); } return $ret; }