Location: PHPKode > projects > ACollab > forums/lock_thread.php
<?php
/****************************************************************************************/
/* ACollab                                                                              */
/****************************************************************************************/
/* Copyright (c) 2002-2004  Adaptive Technology Resource Centre / University of Toronto */
/*                                                                                      */
/* http://atutor.ca/acollab                                                             */
/*                                                                                      */
/* This program is free software. You may redistribute it and/or                        */
/* modify it under the terms of the GNU General Public License                          */
/* as published by the Free Software Foundation; either version 2 of the License,       */
/* or (at your option) any later version.                                               */
/*                                                                                      */
/* This program is distributed in the hope that it will be useful, but                  */
/* WITHOUT ANY WARRANTY; without even the implied warranty of                           */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                                 */
/* See the GNU General Public License for more details.                                 */
/*                                                                                      */
/* You may access the GNU General Public License at:                                    */
/* http://www.opensource.org/licenses/gpl-license.php                                   */
/*                                                                                      */
/* You may contact the Adaptive Technology Resource Centre at                           */
/* Robarts Library, University of Toronto                                               */
/* 130 St. George Street, Toronto, Ontario, Canada M5S 1A5                              */
/* Further contact information is available at http://www.utoronto.ca/atrc/             */
/****************************************************************************************/
/* Programmer:                                                                          */
/* Joel Kronenberg - ATRC                                                               */
/****************************************************************************************/
// $Id: lock_thread.php 219 2004-06-07 15:28:04Z boonhau $

define('AC_INCLUDE_PATH', '../include/');

require(AC_INCLUDE_PATH.'vitals.inc.php');
authenticate(USER_GROUP_ADMIN);

$fid  = intval($_REQUEST['fid']);
$pid  = intval($_REQUEST['pid']);

if ($_POST['cancel']) {
	Header('Location: forum.php?fid='.$fid);
	exit;
}

$forum_info = get_forum_info($fid);
$_SECTION[0][0] = _AC('home');
$_SECTION[0][1] = 'home.php';
$_SECTION[1][0] = _AC('forums');
$_SECTION[1][1] = 'forums/';
$_SECTION[2][0] = _AC('forum').': '.$forum_info['title'];
$_SECTION[2][1] = 'forums/forum.php?fid='.$fid;
$_SECTION[3][0] = _AC('lock_thread');
$_SECTION[3][1] = 'forums/';

if ($_POST['submit']){
	$_POST['lock'] = intval($_POST['lock']);
	$_POST['pid']  = intval($_POST['pid']);

	$sql = "UPDATE ".TABLE_PREFIX."forums_threads SET locked=$_POST[lock] WHERE post_id=$_POST[pid]";
	mysql_query($sql, $db);

	if (($_POST['lock'] == 1) || ($_POST['lock'] == 2)){
		Header('Location: forum.php?fid='.$fid.SEP.'f='.F_THREAD_LOCKED);
		exit;
	}else{
		Header('Location: forum.php?fid='.$fid.SEP.'f='.F_THREAD_UNLOCKED);
		exit;
	}
}

require(AC_INCLUDE_PATH.'header.inc.php');

?>
<br />
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
	<input type="hidden" name="pid" value="<?php echo $pid; ?>" />
	<input type="hidden" name="fid" value="<?php echo $fid; ?>" />
	<table border="0" cellspacing="0" cellpadding="2" align="center" class="box2" summary="">
	<tr>
		<th colspan="3" class="box"><h3><?php echo _AC('lock_thread'); ?></h3></th>
	</tr>
	<?php if ($_GET['unlock']) { ?>
	<tr>
		<td class="row1"><input type="radio" name="lock" value="0" id="un" onfocus="this.className='highlight'" onblur="this.className=''" /><label for="un"><?php echo _AC('unlock'); ?></label></td>
	</tr>
	<?php } ?>
	<tr>
		<td class="row1"><input type="radio" name="lock" value="1" id="rw" <?php
			if (($_GET['unlock'] == '') || ($_GET['unlock'] == 1)) {
				echo ' checked="checked"';
			}
		?> onfocus="this.className='highlight'" onblur="this.className=''" /><label for="rw"><?php echo _AC('lock_no_read');  ?></label></td>
	</tr>
	<tr>
		<td class="row1"><input type="radio" name="lock" value="2" id="w" <?php
			if ($_GET['unlock'] == 2) {
				echo ' checked="checked"';
			}
			?> onfocus="this.className='highlight'" onblur="this.className=''" /><label for="w"><?php echo _AC('lock_no_post');  ?></label></td>
	</tr>
	<tr>
		<td class="row1" align="right"><br /><input type="submit" name="submit" value="<?php echo _AC('apply'); ?>" class="submitY" onfocus="this.className='submitY highlight'" onblur="this.className='submitY'" /> &nbsp; <input type="submit" name="cancel" value="<?php echo _AC('cancel'); ?>" class="submitN" onfocus="this.className='submitN highlight'" onblur="this.className='submitN'" /><br /><br /></td>
	</tr>
	</table>
</form>
<?php
	require(AC_INCLUDE_PATH.'footer.inc.php');
?>
Return current item: ACollab