$rtopic['ft_firstpostername'] = $usr['name']; $rtopic['ft_lastposterid'] = (int) $usr['id']; $rtopic['ft_lastpostername'] = $usr['name']; $db->insert($db_forum_topics, $rtopic); $q = $db->lastInsertId(); $rmsg['fp_cat'] = $s; $rmsg['fp_topicid'] = (int) $q; $rmsg['fp_posterid'] = (int) $usr['id']; $rmsg['fp_postername'] = $usr['name']; $rmsg['fp_creation'] = (int) $sys['now']; $rmsg['fp_updated'] = (int) $sys['now']; $rmsg['fp_posterip'] = $usr['ip']; $db->insert($db_forum_posts, $rmsg); $p = $db->lastInsertId(); if ($cfg['forums']['cat_' . $s]['autoprune'] > 0) { cot_forums_prunetopics('updated', $s, $cfg['forums']['cat_' . $s]['autoprune']); } if ($cfg['forums']['cat_' . $s]['countposts']) { $sql_forums = $db->query("UPDATE {$db_users} SET user_postcount=user_postcount+1 WHERE user_id='" . $usr['id'] . "'"); } if (!$rtopic['ft_mode']) { cot_forums_sectionsetlast($s, "fs_postcount+1", "fs_topiccount+1"); } cot_extrafield_movefiles(); /* === Hook === */ foreach (cot_getextplugins('forums.newtopic.newtopic.done') as $pl) { include $pl; } /* ===== */ if ($cache) { $cfg['cache_forums'] && $cache->page->clear('forums');
$o = 'updated'; } $w = empty($w) || !in_array($w, array('asc', 'desc')) ? 'desc' : $w; cot_die(empty($s) || !isset($structure['forums'][$s]), true); list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('forums', $s); /* === Hook === */ foreach (cot_getextplugins('forums.topics.rights') as $pl) { include $pl; } /* ===== */ cot_block($usr['auth_read']); if ($usr['isadmin'] && !empty($q) && !empty($a)) { cot_check_xg(); switch ($a) { case 'delete': cot_forums_prunetopics('single', $s, $q); cot_log("Deleted topic #" . $q, 'for'); cot_forums_sectionsetlast($s); /* === Hook === */ foreach (cot_getextplugins('forums.topics.delete.done') as $pl) { include $pl; } /* ===== */ break; case 'move': $ns = cot_import('ns', 'P', 'ALP'); $ghost = cot_import('ghost', 'P', 'BOL'); $num = $db->query("SELECT COUNT(*) FROM {$db_forum_posts} WHERE fp_cat=" . $db->quote($s) . " AND fp_topicid = {$q}")->fetchColumn(); if ($num < 1 || $s == $ns || !strpos($structure['forums'][$ns]['path'], '.')) { cot_die(); }