function addTopic() { global $xoopsDB, $_POST; $xt = new XoopsTopic($xoopsDB->prefix("topics")); if (!$xt->topicExists($_POST['topic_pid'], $_POST['topic_pid'])) { $xt->setTopicPid($_POST['topic_pid']); if (empty($_POST['topic_title'])) { redirect_header("index.php?op=topicsmanager", 2, _AM_ERRORTOPICNAME); } $xt->setTopicTitle($_POST['topic_title']); if (isset($_POST['topic_imgurl']) && $_POST['topic_imgurl'] != "") { $xt->setTopicImgurl($_POST['topic_imgurl']); } $xt->store(); $notification_handler =& xoops_gethandler('notification'); $tags = array(); $tags['TOPIC_NAME'] = $_POST['topic_title']; $notification_handler->triggerEvent('global', 0, 'new_category', $tags); redirect_header('index.php?op=topicsmanager', 1, _AM_DBUPDATED); } else { echo "Topic exists!"; } exit; }
function store() { $mode = empty($this->topic_id) ? 'insert' : 'udpate'; parent::store(); if ($mode == 'insert') { $this->topic_id = $this->db->getInsertId(); $this->db->query("UPDATE " . $this->table . " SET topic_created=UNIX_TIMESTAMP(),topic_modified=UNIX_TIMESTAMP() WHERE topic_id=" . $this->topic_id); //ver3.0 $gperm =& BulletinGP::getInstance($this->mydirname); $result = $gperm->insertdefaultpermissions($this->topic_id); } else { $this->db->query("UPDATE " . $this->table . " SET topic_modified=UNIX_TIMESTAMP() WHERE topic_id=" . $this->topic_id); } }
function store() { $mode = empty($this->topic_id) ? 'insert' : 'udpate'; parent::store(); if ($mode == 'insert') { $this->topic_id = $this->db->getInsertId(); $this->db->query("UPDATE " . $this->table . " SET topic_created=UNIX_TIMESTAMP(),topic_modified=UNIX_TIMESTAMP() WHERE topic_id=" . $this->topic_id); } else { $this->db->query("UPDATE " . $this->table . " SET topic_modified=UNIX_TIMESTAMP() WHERE topic_id=" . $this->topic_id); } }