This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
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 | /** |
||
25 | * Entry point of WikiService |
||
26 | * |
||
27 | * This class receive HTTP requests for Wiki Service. |
||
28 | * |
||
29 | * @package WikiService |
||
30 | * @copyright STMicroelectronics, 2005 |
||
31 | * @author Manuel Vacelet <[email protected]> |
||
32 | * @license http://opensource.org/licenses/gpl-license.php GPL |
||
33 | */ |
||
34 | class PHPWikiService extends Controler { |
||
35 | /* private Wiki*/ var $wiki; |
||
36 | |||
37 | /** |
||
38 | * Constructor |
||
39 | */ |
||
40 | function PHPWikiService($id) { |
||
41 | global $LANG, $is_wiki_page; |
||
42 | |||
43 | //used so the search box will add the necessary element to the pop-up box |
||
44 | $is_wiki_page = 1; |
||
45 | |||
46 | /* |
||
47 | * Check given id |
||
48 | */ |
||
49 | $this->gid = (int) $id; |
||
50 | |||
51 | if(empty($this->gid)) |
||
52 | exit_no_group(); |
||
53 | |||
54 | $pm = ProjectManager::instance(); |
||
55 | $go = $pm->getProject($this->gid); |
||
56 | if(!$go) |
||
57 | exit_no_group(); |
||
58 | |||
59 | $this->wiki = new PHPWiki($this->gid); |
||
60 | |||
61 | |||
62 | // Check access right |
||
63 | $this->checkPermissions(); |
||
64 | |||
65 | // If Wiki for project doesn't exist, propose creation ... if user is project admin or wiki admin |
||
66 | if(!$this->wiki->exist()) { |
||
0 ignored issues
–
show
|
|||
67 | if((!user_ismember($this->gid, 'W2'))&&(!user_ismember($this->gid, 'A'))) { |
||
68 | exit_wiki_empty(); |
||
69 | } |
||
70 | } |
||
71 | |||
72 | // Set language for phpWiki |
||
73 | if ($this->wiki->getLanguage_id()) { |
||
74 | define('DEFAULT_LANGUAGE', $this->wiki->getLanguage_id()); |
||
75 | $LANG = $this->wiki->getLanguage_id(); |
||
76 | } |
||
77 | } |
||
78 | |||
79 | |||
80 | /** |
||
81 | * Check access permissions for wiki and wiki pages. |
||
82 | * |
||
83 | * Check restriction for: |
||
84 | * wiki: whole wiki can be restricted. |
||
85 | * wikipage: each page of the wiki can be restricted. |
||
86 | */ |
||
87 | function checkPermissions() { |
||
88 | // Check if user can access to whole wiki |
||
89 | if(!$this->wiki->isAutorized(user_getid())) { |
||
90 | $GLOBALS['Response']->addFeedback( |
||
91 | 'error', |
||
92 | $GLOBALS['Language']->getText( |
||
93 | 'plugin_phpwiki_wikiservice', |
||
94 | 'acces_denied_whole', |
||
95 | session_make_url("/project/memberlist.php?group_id=".$this->gid) |
||
96 | ), |
||
97 | CODENDI_PURIFIER_DISABLED |
||
98 | ); |
||
99 | exit_permission_denied(); |
||
100 | } |
||
101 | |||
102 | // Check if user can access to selected page |
||
103 | if(!empty($_REQUEST['pagename'])) { |
||
104 | $wp = new PHPWikiPage($this->gid, $_REQUEST['pagename']); |
||
105 | if(!$wp->isAutorized(user_getid())) { |
||
106 | $GLOBALS['Response']->addFeedback( |
||
107 | 'error', |
||
108 | $GLOBALS['Language']->getText( |
||
109 | 'plugin_phpwiki_wikiservice', |
||
110 | 'acces_denied_page', |
||
111 | session_make_url("/project/memberlist.php?group_id=".$this->gid) |
||
112 | ), |
||
113 | CODENDI_PURIFIER_DISABLED |
||
114 | ); |
||
115 | exit_permission_denied(); |
||
116 | } |
||
117 | } |
||
118 | } |
||
119 | |||
120 | /** |
||
121 | * Bind http request with views and actions |
||
122 | */ |
||
123 | function request() { |
||
124 | if (!isset($this->view)) |
||
125 | $this->view = 'browse'; |
||
126 | |||
127 | if(!empty($_REQUEST['pagename'])) |
||
128 | $this->view = 'empty'; |
||
129 | |||
130 | if(isset($_REQUEST['format']) && |
||
131 | ($_REQUEST['format'] == 'rss') ) |
||
132 | $this->view = 'empty'; |
||
133 | |||
134 | if(isset($_REQUEST['pv']) && ($_REQUEST['pv'] == 1 || $_REQUEST['pv'] == 2)) |
||
135 | $this->view = 'empty'; |
||
136 | |||
137 | if(isset($_REQUEST['action'])) { |
||
138 | if($_REQUEST['action'] == 'pdf') |
||
139 | $this->view = 'empty'; |
||
140 | |||
141 | if($_REQUEST['action'] == 'ziphtml') |
||
142 | $this->view = 'empty'; |
||
143 | |||
144 | if($_REQUEST['action'] == 'zip') |
||
145 | $this->view = 'empty'; |
||
146 | |||
147 | if($_REQUEST['action'] == 'add_temp_page') |
||
148 | $this->action = 'add_temp_page'; |
||
149 | |||
150 | if($_REQUEST['action'] == 'setWikiPagePerms') |
||
151 | $this->action = 'setWikiPagePerms'; |
||
152 | } |
||
153 | |||
154 | if(isset($_REQUEST['view']) && |
||
155 | ($_REQUEST['view'] == 'browsePages')) |
||
156 | $this->view = 'browsePages'; |
||
157 | |||
158 | // If Wiki for project doesn't exist, propose creation... |
||
159 | if(!$this->wiki->exist()) { |
||
0 ignored issues
–
show
The expression
$this->wiki->exist() of type boolean|null is loosely compared to false ; this is ambiguous if the boolean can be false. You might want to explicitly use !== null instead.
If an expression can have both $a = canBeFalseAndNull();
// Instead of
if ( ! $a) { }
// Better use one of the explicit versions:
if ($a !== null) { }
if ($a !== false) { }
if ($a !== null && $a !== false) { }
![]() |
|||
160 | if (!isset($_REQUEST['view']) || (isset($_REQUEST['view']) && $_REQUEST['view'] != 'doinstall')) |
||
161 | $this->view='install'; |
||
162 | else $this->view='doinstall'; |
||
163 | } |
||
164 | |||
165 | } |
||
166 | |||
167 | } |
||
168 | ?> |
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.