1 | <?php
|
---|
2 | /*
|
---|
3 | $Id: archive_submit.php 2175 2009-04-07 09:24:44Z andrewsimpson $
|
---|
4 |
|
---|
5 | (c) 2004 - 2009 Andrew Simpson <andrew.simpson at paradise.net.nz>
|
---|
6 |
|
---|
7 | WebCollab
|
---|
8 | ---------------------------------------
|
---|
9 |
|
---|
10 | This program is free software; you can redistribute it and/or modify it under the
|
---|
11 | terms of the GNU General Public License as published by the Free Software Foundation;
|
---|
12 | either version 2 of the License, or (at your option) any later version.
|
---|
13 |
|
---|
14 | This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
---|
15 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
---|
16 | PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
---|
17 |
|
---|
18 | You should have received a copy of the GNU General Public License along with this
|
---|
19 | program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
---|
20 | Cambridge, MA 02139, USA.
|
---|
21 |
|
---|
22 | Function:
|
---|
23 | ---------
|
---|
24 |
|
---|
25 | Archives or restores projects in the database
|
---|
26 |
|
---|
27 | */
|
---|
28 |
|
---|
29 | //security check
|
---|
30 | if(! defined('UID' ) ) {
|
---|
31 | die('Direct file access not permitted' );
|
---|
32 | }
|
---|
33 |
|
---|
34 | if(! @safe_integer($_REQUEST['taskid']) ) {
|
---|
35 | error('Archive submit', 'Not a valid taskid' );
|
---|
36 | }
|
---|
37 | $taskid = $_REQUEST['taskid'];
|
---|
38 |
|
---|
39 | //check if the user has enough rights
|
---|
40 | if( ( ! ADMIN ) && (db_result(db_query('SELECT COUNT(*) FROM '.PRE.'tasks WHERE id='.$taskid.' AND owner='.UID ), 0, 0 ) < 1) ){
|
---|
41 | warning($lang['task_submit'], $lang['not_owner'] );
|
---|
42 | }
|
---|
43 |
|
---|
44 | $projectid = db_result(db_query('SELECT projectid FROM '.PRE.'tasks WHERE id='.$taskid ), 0, 0 );
|
---|
45 |
|
---|
46 | switch($_REQUEST['action'] ) {
|
---|
47 |
|
---|
48 | case 'submit_archive':
|
---|
49 | //do the archiving
|
---|
50 | db_query('UPDATE '.PRE.'tasks SET archive=1 WHERE projectid='.$projectid );
|
---|
51 |
|
---|
52 | header('Location: '.BASE_URL.'main.php?x='.X );
|
---|
53 | die;
|
---|
54 | break;
|
---|
55 |
|
---|
56 | case 'submit_restore':
|
---|
57 | //do the restore
|
---|
58 | db_query('UPDATE '.PRE.'tasks SET archive=0 WHERE projectid='.$projectid );
|
---|
59 |
|
---|
60 | header('Location: '.BASE_URL.'archive.php?x='.X.'&action=list' );
|
---|
61 | die;
|
---|
62 | break;
|
---|
63 |
|
---|
64 | default:
|
---|
65 | error('Archive submit', 'Invalid request given');
|
---|
66 | break;
|
---|
67 | }
|
---|
68 |
|
---|
69 | ?>
|
---|