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\Services; |
||
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 | * exceptions are not handled here. |
||
30 | * This class just provides simple services and uses the domainmodel in classes directory! |
||
31 | * |
||
32 | * Methods can be used uninstanciated |
||
33 | */ |
||
34 | class FeServices extends AbstractServices { |
||
35 | |||
36 | /** |
||
37 | * The cache frontend |
||
38 | * |
||
39 | * @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface |
||
40 | */ |
||
41 | protected static $cache = NULL; |
||
42 | |||
43 | /** |
||
44 | * @param $uid |
||
45 | * @param $table |
||
46 | * @param $lUid |
||
47 | * @return mixed |
||
48 | */ |
||
49 | public static function getFallbackOrderForElement($uid, $table, $lUid) { |
||
50 | $dao = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\Dao\DaoCommon'); |
||
51 | $elementfactory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\ElementFactory', $dao); |
||
52 | $element = $elementfactory->getElementForTable($table, $uid); |
||
53 | $languageRep = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\LanguageRepository'); |
||
54 | $language = $languageRep->getLanguageById($lUid); |
||
55 | |||
56 | return $language->getFallbackOrderElement($element); |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * @param $uid |
||
61 | * @param $table |
||
62 | * @param $lUid |
||
63 | * @return mixed |
||
64 | */ |
||
65 | public static function checkVisiblityForElement($uid, $table, $lUid) { |
||
66 | $dao = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\Dao\DaoCommon'); |
||
67 | $elementfactory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\ElementFactory', $dao); |
||
68 | $element = $elementfactory->getElementForTable($table, $uid); |
||
69 | $languageRep = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\LanguageRepository'); |
||
70 | $language = $languageRep->getLanguageById($lUid); |
||
71 | $visibility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\Services\\VisibilityService'); |
||
72 | |||
73 | return $visibility->isVisible($language, $element); |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * @param $uid |
||
78 | * @param $table |
||
79 | * @return \AOE\Languagevisibility\Element |
||
80 | */ |
||
81 | public static function getElement($uid, $table) { |
||
82 | $dao = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\Dao\DaoCommon'); |
||
83 | /** @var $elementfactory \\AOE\\Languagevisibility\\ElementFactory */ |
||
84 | $elementfactory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\ElementFactory', $dao); |
||
85 | $element = $elementfactory->getElementForTable($table, $uid); |
||
86 | |||
87 | return $element; |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * @param $element |
||
92 | * @param $lUid |
||
93 | * @return mixed |
||
94 | */ |
||
95 | public static function getOverlayLanguageIdForElement($element, $lUid) { |
||
96 | $languageRep = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\LanguageRepository'); |
||
97 | $language = $languageRep->getLanguageById($lUid); |
||
98 | $visibility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\Services\\VisibilityService'); /** @var $visibility \\AOE\\Languagevisibility\\Services\\VisibilityService */ |
||
99 | |||
100 | return $visibility->getOverlayLanguageIdForLanguageAndElement($language, $element); |
||
101 | } |
||
102 | |||
103 | /** |
||
104 | * @param $uid |
||
105 | * @param $table |
||
106 | * @param $lUid |
||
107 | * @return mixed |
||
108 | */ |
||
109 | public static function getOverlayLanguageIdForElementRecord($uid, $table, $lUid) { |
||
110 | $cacheKey = sha1(implode('_', array(get_class(), __FUNCTION__, $uid, $table, $lUid))); |
||
111 | if (self::getCache()->has($cacheKey)) { |
||
112 | return self::getCache()->get($cacheKey); |
||
113 | } |
||
114 | $dao = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\Dao\DaoCommon'); |
||
115 | $elementfactory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\ElementFactory', $dao); |
||
116 | $element = $elementfactory->getElementForTable($table, $uid); |
||
117 | $languageRep = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\LanguageRepository'); |
||
118 | $language = $languageRep->getLanguageById($lUid); |
||
119 | |||
120 | $visibility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\Services\\VisibilityService'); |
||
121 | $overlayLanguageId = $visibility->getOverlayLanguageIdForLanguageAndElement($language, $element); |
||
122 | self::getCache()->set($cacheKey, $overlayLanguageId); |
||
123 | return $overlayLanguageId; |
||
124 | } |
||
125 | |||
126 | /** |
||
127 | * @param $uid |
||
128 | * @param $table |
||
129 | * @param $lUid |
||
130 | * @return mixed |
||
131 | */ |
||
132 | public static function getOverlayLanguageIdForElementRecordForced($uid, $table, $lUid) { |
||
133 | $dao = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\Dao\DaoCommon'); |
||
134 | $elementfactory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\ElementFactory', $dao); |
||
135 | $element = $elementfactory->getElementForTable($table, $uid); |
||
136 | $languageRep = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\LanguageRepository'); |
||
137 | $language = $languageRep->getLanguageById($lUid); |
||
138 | |||
139 | $visibility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\Services\\VisibilityService'); |
||
140 | $visibility->isVisible($language, $element); |
||
141 | return $visibility->getLastRelevantOverlayLanguageId(); |
||
142 | } |
||
143 | |||
144 | /** |
||
145 | * Check if given element has traslation in given language |
||
146 | * |
||
147 | * @param int $elementUid |
||
148 | * @param string $table |
||
149 | * @param int $languageUid |
||
150 | * @return boolean |
||
151 | */ |
||
152 | public static function hasTranslation($elementUid, $table, $languageUid) { |
||
153 | $dao = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\Dao\DaoCommon'); |
||
154 | $elementfactory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\ElementFactory', $dao); |
||
155 | |||
156 | $result = FALSE; |
||
157 | try { |
||
158 | $element = $elementfactory->getElementForTable($table, $elementUid); |
||
159 | $result = $element->hasTranslation($languageUid); |
||
160 | } catch ( UnexpectedValueException $e ) { |
||
0 ignored issues
–
show
|
|||
161 | //the element can not be handeld by language visibility |
||
162 | $result = FALSE; |
||
163 | } |
||
164 | |||
165 | return $result; |
||
166 | } |
||
167 | |||
168 | /** |
||
169 | * Gets the cache frontend for tx_languagevisibility |
||
170 | * |
||
171 | * @return \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend |
||
172 | */ |
||
173 | public static function getCache() { |
||
174 | if (!self::$cache) { |
||
175 | self::$cache = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager') |
||
176 | ->getCache('tx_languagevisibility'); |
||
177 | } |
||
178 | return self::$cache; |
||
179 | } |
||
180 | } |
||
181 |
Scrutinizer analyzes your
composer.json
/composer.lock
file if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.