Location: PHPKode > projects > PapyrusBB > PapyrusBB-0.6/include/admin/moveTopic.php
<?php
wbLang::pluginFile('admin.php');

class moveTopic{
	
	//this should be an admin script
	function move(){
		global $wbTables;
		
		if( $_SESSION['userlevel'] !== 5 ){
			message('AREA_RESTRICTED');
			return;
		}
		if( !is_numeric($_POST['newforum']) ){
			message('INVALID_REQUEST');
			return;
		}
		if( !is_numeric($_POST['current']) ){
			message('INVALID_REQUEST');
			return;
		}
		
		//bb_posts
		$query = 'UPDATE '.$wbTables['bb_posts'];
		$query .= ' SET ';
		$query .= ' `modified` = `modified` ';
		$query .= ', `forum_id` = "'.$_POST['newforum'].'" ';
		$query .= ' WHERE ';
		$query .= ' `forum_id` = "'.$this->parent->ids['forum'].'" ';
		$query .= ' AND `file_id` = "'.$_POST['current'].'" ';
		if( !wbDB::runQuery($query) ){
			message('here');
			return;
		}
		
		//bb_topics
		$query = 'UPDATE '.$wbTables['bb_topics'];
		$query .= ' SET ';
		$query .= ' `modified` = `modified` ';
		$query .= ', `forum_id` = "'.$_POST['newforum'].'" ';
		$query .= ' WHERE ';
		$query .= ' `forum_id` = "'.$this->parent->ids['forum'].'" ';
		$query .= ' AND `file_id` = "'.$_POST['current'].'" ';
		wbDB::runQuery($query);
	
		message('topic_updated');
		
		pluginIncludeFile('include/admin/adminSync.php');
		forumSync::sync($this->parent->ids['forum']);
		forumSync::sync($_POST['newforum']);
		
	}	
}
Return current item: PapyrusBB