1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* Copyright (c) Enalean, 2015. All Rights Reserved. |
4
|
|
|
* Copyright 2005, STMicroelectronics |
5
|
|
|
* |
6
|
|
|
* Originally written by Manuel Vacelet |
7
|
|
|
* |
8
|
|
|
* This file is a part of Tuleap. |
9
|
|
|
* |
10
|
|
|
* Tuleap is free software; you can redistribute it and/or modify |
11
|
|
|
* it under the terms of the GNU General Public License as published by |
12
|
|
|
* the Free Software Foundation; either version 2 of the License, or |
13
|
|
|
* (at your option) any later version. |
14
|
|
|
* |
15
|
|
|
* Tuleap is distributed in the hope that it will be useful, |
16
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18
|
|
|
* GNU General Public License for more details. |
19
|
|
|
* |
20
|
|
|
* You should have received a copy of the GNU General Public License |
21
|
|
|
* along with Tuleap. If not, see <http://www.gnu.org/licenses/>. |
22
|
|
|
*/ |
23
|
|
|
|
24
|
|
|
require_once('common/mvc/Controler.class.php'); |
25
|
|
|
require_once(dirname(__FILE__) . '/actions/PHPWikiServiceAdminActions.class.php'); |
26
|
|
|
require_once(dirname(__FILE__) . '/views/PHPWikiServiceAdminViews.class.php'); |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* |
30
|
|
|
* @package WikiService |
31
|
|
|
* @subpackage WikiServiceAdmin |
32
|
|
|
* @copyright STMicroelectronics, 2005 |
33
|
|
|
* @author Manuel Vacelet <[email protected]> |
34
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL |
35
|
|
|
*/ |
36
|
|
|
class PHPWikiServiceAdmin extends Controler { |
37
|
|
|
/* private Wiki*/ var $wiki; |
38
|
|
|
|
39
|
|
|
function PHPWikiServiceAdmin($id) { |
40
|
|
|
global $LANG, $is_wiki_page; |
41
|
|
|
|
42
|
|
|
//used so the search box will add the necessary element to the pop-up box |
43
|
|
|
$is_wiki_page = 1; |
44
|
|
|
|
45
|
|
|
$this->gid = (int) $id; |
46
|
|
|
|
47
|
|
|
if(empty($this->gid)) |
48
|
|
|
exit_no_group(); |
49
|
|
|
|
50
|
|
|
if(!user_ismember($this->gid, 'W2')) |
51
|
|
|
exit_permission_denied(); |
52
|
|
|
|
53
|
|
|
$this->wiki = new PHPWiki($this->gid); |
54
|
|
|
|
55
|
|
|
// If Wiki for project doesn't exist, propose creation... |
56
|
|
|
if(!$this->wiki->exist()) { |
|
|
|
|
57
|
|
|
header('Location: ' . PHPWIKI_PLUGIN_BASE_URL . '/index.php?group_id='.$this->gid.'&view=install'); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
// Set language for phpWiki |
61
|
|
|
if ($this->wiki->getLanguage_id()) { |
62
|
|
|
define('DEFAULT_LANGUAGE', $this->wiki->getLanguage_id()); |
63
|
|
|
$LANG = $this->wiki->getLanguage_id(); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
function request() { |
69
|
|
|
// Default behaviour: display default view: |
70
|
|
|
$this->view = 'main'; |
71
|
|
|
|
72
|
|
|
if(!empty($_REQUEST['view'])) |
73
|
|
|
$this->view = $_REQUEST['view']; |
74
|
|
|
|
75
|
|
|
if(!empty($_REQUEST['action'])) { |
76
|
|
|
$this->action = $_REQUEST['action']; |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
} |
81
|
|
|
|
If an expression can have both
false
, andnull
as possible values. It is generally a good practice to always use strict comparison to clearly distinguish between those two values.