function addboard() { global $tc_db, $smarty, $tpl_page, $board_class; $this->AdministratorsOnly(); $tpl_page .= '

' . ucwords(_('Add board')) . '


'; if (isset($_POST['directory'])) { if ($_POST['directory'] != '' && $_POST['desc'] != '') { $results = $tc_db->GetAll("SELECT HIGH_PRIORITY * FROM `" . TC_DBPREFIX . "boards` WHERE `name` = '" . mysql_real_escape_string($_POST['directory']) . "'"); if (count($results) == 0) { if (isset($_POST['makedirs'])) { echo 'Attempting to create the root board folder...
'; if (mkdir(TC_BOARDSDIR . $_POST['directory'], 0755)) { echo 'Success'; } else { die ('Failed.'); } echo 'Attempting to create the res folder...
'; if (mkdir(TC_BOARDSDIR . $_POST['directory'] . '/res', 0755)) { echo 'Success'; } else { die ('Failed.'); } echo 'Attempting to create the src folder...
'; if (mkdir(TC_BOARDSDIR . $_POST['directory'] . '/src', 0755)) { echo 'Success'; } else { die ('Failed.'); } echo 'Attempting to create the thumb folder...
'; if (mkdir(TC_BOARDSDIR . $_POST['directory'] . '/thumb', 0755)) { echo 'Success'; } else { die ('Failed.'); } } else { echo 'Checking for the root board folder...
'; if (is_dir(TC_BOARDSDIR . $_POST['directory'])) { echo 'Success'; } else { die ('Failed.'); } echo 'Checking for the res folder...
'; if (is_dir(TC_BOARDSDIR . $_POST['directory'] . '/res')) { echo 'Success'; } else { die ('Failed.'); } echo 'Checking for the src folder...
'; if (is_dir(TC_BOARDSDIR . $_POST['directory'] . '/src')) { echo 'Success'; } else { die ('Failed.'); } echo 'Checking for the thumb folder...
'; if (is_dir(TC_BOARDSDIR . $_POST['directory'] . '/thumb')) { echo 'Success'; } else { die ('Failed.'); } } file_put_contents(TC_BOARDSDIR . $_POST['directory'] . '/.htaccess', 'DirectoryIndex board.html'); $tc_db->Execute("INSERT INTO `" . TC_DBPREFIX . "boards` ( `name` , `desc` , `createdon` ) VALUES ( '" . mysql_real_escape_string($_POST['directory']) . "' , '" . mysql_real_escape_string($_POST['desc']) . "' , '" . time() . "' )"); if ($_POST['firstpostid'] < 1) { $_POST['firstpostid'] = 1; } $tc_db->Execute("CREATE TABLE `" . TC_DBPREFIX . "posts_" . mysql_real_escape_string($_POST['directory']) . "` ( `id` int(10) NOT NULL auto_increment, `threadid` int(10) NOT NULL default '0', `user` varchar(255) NOT NULL, `tripcode` varchar(10) NOT NULL, `email` varchar(255) NOT NULL, `subject` varchar(255) NOT NULL, `message` text NOT NULL, `image` varchar(20) NOT NULL, `imagetype` varchar(5) NOT NULL, `imagemd5` text NOT NULL, `image_w` smallint(5) NOT NULL default '0', `image_h` smallint(5) NOT NULL default '0', `image_size` int(10) NOT NULL default '0', `thumb_w` smallint(5) NOT NULL default '0', `thumb_h` smallint(5) NOT NULL default '0', `password` varchar(255) NOT NULL, `postedat` int(20) NOT NULL, `lastbumped` int(20) NOT NULL default '0', `ip` varchar(75) NOT NULL, `ipmd5` varchar(200) NOT NULL, `stickied` tinyint(1) NOT NULL default '0', `locked` tinyint(1) NOT NULL default '0', `posterauthority` tinyint(1) NOT NULL default '0', `IS_DELETED` tinyint(1) NOT NULL default '0', UNIQUE KEY `id` (`id`), KEY `threadid` (`threadid`), KEY `lastbumped` (`lastbumped`) ) ENGINE=MyISAM AUTO_INCREMENT=" . mysql_real_escape_string($_POST['firstpostid']) . " ;"); /* Sleep for five seconds, to ensure the table was created before attempting to initialize a board class with it */ sleep(5); $board_class = new Board(mysql_real_escape_string($_POST['directory'])); $board_class->RegenerateAll(); $tpl_page .= _('Board successfully added.') . '

/' . $_POST['directory'] . '/!'; management_addlogentry(_('Added board') . ': /' . $_POST['directory'] . '/', 3); } else { $tpl_page .= _('A board with that name already exists.'); } } else { $tpl_page .= _('Please fill in all required fields.'); } } $tpl_page .= '
The directory of the board. Only put in the letter(s) of the board directory, no slashes!

The name of the board.

The first post of this board will recieve this ID.

If checked, the script will attempt to create the directories itself. If this fails, create boardname/, boardname/res, boardname/src, and boardname/thumb, and chmod each to 755.

'; }