$pattern = '/^!((close|open|lock|unlock|delpost|deltopic)|(move)( ?to)? (.*))$/mi'; preg_match_all($pattern, $txt, $matches, PREG_PATTERN_ORDER); if(!class_exists('modfunctions')) include 'modfunctions.php'; $mod = new modfunctions(); foreach($matches[2] as $km => $match) { if($match == 'unlock') $match = 'open'; if($match == 'lock') $match = 'close'; switch($match) { case 'open': $this->previewer->post_functions->topic['force_state'] = 'open'; $mod->topic_open($topic); break; case 'close': if($topic == 0) $_REQUEST['mod_options'] = $_REQUEST['mod_options'] == 'pin' ? 'pinclose' : 'close' ; else { $this->previewer->post_functions->topic['force_state'] = 'closed'; $mod->topic_close($topic); } break; case 'delpost': if($post > 0) { $DB->query("DELETE FROM ibf_posts WHERE pid = $post"); $mod->add_moderate_log($forum, $topic, $ttitle, $post, 'Deleted post'); } break; case 'deltopic': if($topic == 0) break; $mod->topic_delete($topic); $mod->forum_recount($forum); $print->redirect_screen( $ibforums->lang['mod_delete'], "showforum=$forum" ); /* redirect it */ break; case '':switch($matches[3][$km]) { case 'move': $DB->query('SELECT id, parent_id FROM ibf_forums WHERE replace(name," ","") = "' . addslashes(str_replace(' ', '', htmlentities($matches[5][$km]))) . '"'); $res = $DB->fetch_row(); if($res !== FALSE) { $mod->topic_move($topic, $forum, $res['id'], 0); $this->previewer->forum['id'] = $res['id']; $mod->forum_recount($forum); $mod->forum_recount($res['id']); if($res['parent_id'] != -1) $mod->forum_recount($res['parent_id']); } break; }break; } } $mod->forum_recount($forum);