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 | namespace AOE\Languagevisibility; |
||
4 | |||
5 | /*************************************************************** |
||
6 | * Copyright notice |
||
7 | * |
||
8 | * (c) 2016 AOE GmbH <[email protected]> |
||
9 | * All rights reserved |
||
10 | * |
||
11 | * This script is part of the TYPO3 project. The TYPO3 project is |
||
12 | * free software; you can redistribute it and/or modify |
||
13 | * it under the terms of the GNU General Public License as published by |
||
14 | * the Free Software Foundation; either version 2 of the License, or |
||
15 | * (at your option) any later version. |
||
16 | * |
||
17 | * The GNU General Public License can be found at |
||
18 | * http://www.gnu.org/copyleft/gpl.html. |
||
19 | * |
||
20 | * This script is distributed in the hope that it will be useful, |
||
21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
23 | * GNU General Public License for more details. |
||
24 | * |
||
25 | * This copyright notice MUST APPEAR in all copies of the script! |
||
26 | ***************************************************************/ |
||
27 | |||
28 | /** |
||
29 | * |
||
30 | * @author Daniel Poetzinger <[email protected]> |
||
31 | * @coauthor Tolleiv Nietsch <[email protected]> |
||
32 | * @coauthor Timo Schmidt <[email protected]> |
||
33 | */ |
||
34 | class PageElement extends Element { |
||
35 | |||
36 | /** |
||
37 | * Returns if this Element is a translation or not. |
||
38 | * Pages are always original records, because overlays are stored in the |
||
39 | * table pages_language_overlay |
||
40 | * |
||
41 | * @return boolean |
||
42 | */ |
||
43 | protected function isOrigElement() { |
||
44 | return TRUE; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Returns a simple description of the element type. |
||
49 | * |
||
50 | * @return string |
||
51 | */ |
||
52 | public function getElementDescription() { |
||
53 | return 'Page'; |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * This method is used to determine if this element is an element |
||
58 | * in the default language. For pages this is always true, because |
||
59 | * the table pages does not contain translations. |
||
60 | * |
||
61 | * @return boolean |
||
62 | */ |
||
63 | public function isLanguageSetToDefault() { |
||
64 | return TRUE; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Returns an Informative description of the element. |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | public function getInformativeDescription() { |
||
73 | return 'this is a normal page element (translations are managed with seperate overlay records)'; |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * Method to get an overlay of an element for a certain langugae |
||
78 | * |
||
79 | * @param int $lUid |
||
80 | * @internal param bool $onlyUid |
||
81 | * @return array return the database row |
||
82 | */ |
||
83 | protected function getOverLayRecordForCertainLanguageImplementation($lUid) { |
||
84 | if ($lUid > 0) { |
||
85 | $fieldArr = explode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['pageOverlayFields']); |
||
86 | $page_id = $this->row['t3ver_oid']?$this->row['t3ver_oid']:$this->getUid(); // Was the whole record |
||
87 | $fieldArr = array_intersect($fieldArr,array_keys($this->row)); // Make sure that only fields which exist in the incoming record are overlaid! |
||
88 | |||
89 | if (count($fieldArr)) { |
||
90 | $table = 'pages_language_overlay'; |
||
91 | if (is_object($GLOBALS['TSFE']->sys_page)) { |
||
92 | $enableFields = $GLOBALS['TSFE']->sys_page->enableFields($table); |
||
93 | } else { |
||
94 | $enableFields = \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table); |
||
95 | } |
||
96 | $fieldArr[] = 'deleted'; |
||
97 | $fieldArr[] = 'hidden'; |
||
98 | $fieldArr[] = 'tx_languagevisibility_visibility'; |
||
99 | |||
100 | // Selecting overlay record: |
||
101 | $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
||
102 | implode(',', $fieldArr), |
||
103 | 'pages_language_overlay', |
||
104 | 'pid=' . intval($page_id) . ' |
||
105 | AND sys_language_uid=' . intval($lUid) . |
||
106 | $enableFields, |
||
107 | '', |
||
108 | '', |
||
109 | '1' |
||
110 | ); |
||
111 | $olrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); |
||
112 | $olrow = $this->getContextIndependentWorkspaceOverlay($table, $olrow); |
||
113 | $GLOBALS['TYPO3_DB']->sql_free_result($res); |
||
114 | |||
115 | if ($this->getEnableFieldResult($olrow)) { |
||
116 | $overlayRecord = $olrow; |
||
117 | } |
||
118 | } else { |
||
119 | $overlayRecord = $this->row; |
||
120 | } |
||
121 | } else { |
||
122 | $overlayRecord = $this->row; |
||
123 | } |
||
124 | return $overlayRecord; |
||
0 ignored issues
–
show
|
|||
125 | } |
||
126 | |||
127 | /** |
||
128 | * Returns which field in the language should be used to read the default visibility |
||
129 | * |
||
130 | * @return string (blank=default / page=page) |
||
131 | */ |
||
132 | public function getFieldToUseForDefaultVisibility() { |
||
133 | return 'page'; |
||
134 | } |
||
135 | |||
136 | /** |
||
137 | * Method to determine if this element has any translations in any workspace. |
||
138 | * |
||
139 | * @return boolean |
||
140 | */ |
||
141 | public function hasOverLayRecordForAnyLanguageInAnyWorkspace() { |
||
142 | //if we handle a workspace record, we need to get it's live version |
||
143 | if ($this->row['pid'] == -1) { |
||
144 | $useUid = $this->row['t3ver_oid']; |
||
145 | } else { |
||
146 | $useUid = $this->row['uid']; |
||
147 | } |
||
148 | |||
149 | // if a workspace record has an overlay, an overlay also exists in the livews with versionstate = 1 |
||
150 | // therefore we have to look for any undeleted overlays of the live version |
||
151 | $fields = 'count(uid) as anz'; |
||
152 | $table = 'pages_language_overlay'; |
||
153 | $where = 'deleted = 0 AND pid=' . $useUid; |
||
154 | |||
155 | $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fields, $table, $where); |
||
156 | $anz = $rows[0]['anz']; |
||
157 | |||
158 | return ($anz > 0); |
||
159 | } |
||
160 | |||
161 | /** |
||
162 | * The page elements supports inheritance. |
||
163 | * |
||
164 | * @param void |
||
165 | * @return boolean |
||
166 | */ |
||
167 | public function supportsInheritance() { |
||
168 | return TRUE; |
||
169 | } |
||
170 | } |
||
171 |
If you define a variable conditionally, it can happen that it is not defined for all execution paths.
Let’s take a look at an example:
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.
Available Fixes
Check for existence of the variable explicitly:
Define a default value for the variable:
Add a value for the missing path: