remove old readme
[atutor.git] / mods / _standard / forums / forum / lock_thread.php
1 <?php
2 /****************************************************************/
3 /* ATutor                                                                                                               */
4 /****************************************************************/
5 /* Copyright (c) 2002-2010                                      */
6 /* Inclusive Design Institute                                   */
7 /* http://atutor.ca                                                                                             */
8 /*                                                              */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License  */
11 /* as published by the Free Software Foundation.                                */
12 /****************************************************************/
13 // $Id$
14
15 $fid  = intval($_REQUEST['fid']);
16  
17 if ($fid == 0) {
18         $fid  = intval($_GET['fid']);
19 }
20 define('AT_INCLUDE_PATH', '../../../../include/');
21 require(AT_INCLUDE_PATH.'vitals.inc.php');
22
23 authenticate(AT_PRIV_FORUMS);
24
25 $_pages['mods/_standard/forums/forum/index.php?fid='.$fid]['title']    = get_forum_name($fid);
26 $_pages['mods/_standard/forums/forum/index.php?fid='.$fid]['parent']   = 'mods/_standard/forums/forum/list.php';
27 $_pages['mods/_standard/forums/forum/index.php?fid='.$fid]['children'] = array('mods/_standard/forums/forum/new_thread.php?fid='.$fid);
28
29 $_pages['mods/_standard/forums/forum/new_thread.php?fid='.$fid]['title_var'] = 'new_thread';
30 $_pages['mods/_standard/forums/forum/new_thread.php?fid='.$fid]['parent']    = 'mods/_standard/forums/forum/index.php?fid='.$fid;
31
32 $_pages['mods/_standard/forums/forum/view.php']['title']  = $post_row['subject'];
33 $_pages['mods/_standard/forums/forum/view.php']['parent'] = 'mods/_standard/forums/forum/index.php?fid='.$fid;
34
35 $_pages['mods/_standard/forums/forum/lock_thread.php']['title_var'] = 'lock_thread';
36 $_pages['mods/_standard/forums/forum/lock_thread.php']['parent']    = 'mods/_standard/forums/forum/index.php?fid='.$fid;
37
38 if (isset($_POST['cancel'])) {
39         $msg->addFeedback('CANCELLED');
40         header('Location: '.AT_BASE_HREF.'mods/_standard/forums/forum/index.php?fid='.$fid);
41         exit;
42 } else if (isset($_POST['submit'])) {
43         $_POST['lock'] = intval($_POST['lock']);
44         $_POST['pid']  = intval($_POST['pid']);
45         $_POST['fid']  = intval($_POST['fid']);
46
47         $sql    = "UPDATE ".TABLE_PREFIX."forums_threads SET locked=$_POST[lock], last_comment=last_comment, date=date WHERE post_id=$_POST[pid]";
48         $result = mysql_query($sql, $db);
49
50         if($_POST['lock'] == '1' || $_POST['lock'] == '2'){
51                 $msg->addFeedback('THREAD_LOCKED');
52                 header('Location: '.AT_BASE_HREF.'mods/_standard/forums/forum/index.php?fid='.$fid);
53                 exit;
54         } else {
55                 $msg->addFeedback('THREAD_UNLOCKED');
56                 header('Location: '.AT_BASE_HREF.'mods/_standard/forums/forum/index.php?fid='.$fid);
57                 exit;
58         }
59 }
60
61 require(AT_INCLUDE_PATH.'header.inc.php');
62
63 $pid  = intval($_GET['pid']);
64 $fid  = intval($_GET['fid']);
65 ?>
66 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
67 <input type="hidden" name="pid" value="<?php echo $pid?>">
68 <input type="hidden" name="fid" value="<?php echo $fid?>">
69
70 <div class="input-form" style="width: 40%;">
71
72 <?php if ($_GET['unlock']): ?>
73         <div class="row">
74                 <input type="radio" name="lock" value="0" id="un"><label for="un"><?php echo _AT('unlock_thread'); ?></label>
75         </div>
76
77 <?php endif; ?>
78         <div class="row">
79                 <input type="radio" name="lock" value="1" id="rw" <?php
80                 if (($_GET['unlock'] == '') || ($_GET['unlock'] == 1)) {
81                         echo ' checked="checked"';
82                 }
83                 ?>><label for="rw"><?php echo _AT('lock_no_read');  ?></label><br />
84                 <input type="radio" name="lock" value="2" id="w" <?php
85                 if ($_GET['unlock'] == 2) {
86                         echo ' checked="checked"';
87                 }
88                 ?>><label for="w"><?php echo _AT('lock_no_post');  ?></label>
89         </div>
90
91         <div class="row buttons">
92                 <input name="submit" type="submit" value="<?php echo _AT('lock_submit');  ?>" />
93                 <input name="cancel" type="submit" value="<?php echo _AT('cancel');  ?>" />
94         </div>
95 </div>
96
97 </form>
98 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>