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 | * This page manages searching for products. |
||
4 | * |
||
5 | * @authors: Nicolaas [at] Sunny Side Up .co.nz |
||
6 | * @package: ecommerce |
||
7 | * @sub-package: Pages |
||
8 | **/ |
||
9 | class ProductGroupSearchPage extends ProductGroup |
||
10 | { |
||
11 | |||
12 | /** |
||
13 | * standard SS variable. |
||
14 | * |
||
15 | * @static String | Array |
||
16 | */ |
||
17 | private static $icon = 'ecommerce/images/icons/productgroupsearchpage'; |
||
0 ignored issues
–
show
Comprehensibility
introduced
by
![]() |
|||
18 | |||
19 | /** |
||
20 | * Standard SS variable. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | private static $description = 'This page allowing the user to search for products.'; |
||
0 ignored issues
–
show
|
|||
25 | |||
26 | /** |
||
27 | * Standard SS variable. |
||
28 | */ |
||
29 | private static $singular_name = 'Product Search Page'; |
||
0 ignored issues
–
show
|
|||
30 | public function i18n_singular_name() |
||
31 | { |
||
32 | return _t('ProductGroupSearchPage.SINGULARNAME', 'Product Search Page'); |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Standard SS variable. |
||
37 | */ |
||
38 | private static $plural_name = 'Product Search Pages'; |
||
0 ignored issues
–
show
|
|||
39 | public function i18n_plural_name() |
||
40 | { |
||
41 | return _t('ProductGroupSearchPage.PLURALNAME', 'Product Search Pages'); |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * Standard SS function, we only allow for one Product Search Page to exist |
||
46 | * but we do allow for extensions to exist at the same time. |
||
47 | * |
||
48 | * @param Member $member |
||
0 ignored issues
–
show
Should the type for parameter
$member not be Member|null ?
This check looks for It makes a suggestion as to what type it considers more descriptive. Most often this is a case of a parameter that can be null in addition to its declared types. ![]() |
|||
49 | * |
||
50 | * @return bool |
||
51 | */ |
||
52 | public function canCreate($member = null) |
||
53 | { |
||
54 | return ProductGroupSearchPage::get()->filter(array('ClassName' => 'ProductGroupSearchPage'))->Count() ? false : $this->canEdit($member); |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * Can product list (and related) be cached at all? |
||
59 | * |
||
60 | * @var bool |
||
61 | */ |
||
62 | protected $allowCaching = false; |
||
63 | |||
64 | /** |
||
65 | * This is a KEY method that overrides the standard method! |
||
66 | * @return [type] [description] |
||
0 ignored issues
–
show
The doc-type
[type] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
67 | */ |
||
68 | public function getGroupFilter() |
||
69 | { |
||
70 | $resultArray = $this->searchResultsArrayFromSession(); |
||
71 | $this->allProducts = $this->allProducts->filter(array('ID' => $resultArray)); |
||
72 | |||
73 | return $this->allProducts; |
||
74 | } |
||
75 | |||
76 | |||
77 | /** |
||
78 | * returns the SORT part of the final selection of products. |
||
79 | * |
||
80 | * @return string | Array |
||
0 ignored issues
–
show
|
|||
81 | */ |
||
82 | protected function currentSortSQL() |
||
83 | { |
||
84 | $sortKey = $this->getCurrentUserPreferences('SORT'); |
||
85 | |||
86 | return $this->getUserSettingsOptionSQL('SORT', $sortKey); |
||
87 | } |
||
88 | |||
89 | public function childGroups($maxRecursiveLevel, $filter = null, $numberOfRecursions = 0) |
||
90 | { |
||
91 | return ArrayList::create(); |
||
92 | } |
||
93 | } |
||
94 | |||
95 | class ProductGroupSearchPage_Controller extends ProductGroup_Controller |
||
96 | { |
||
97 | /** |
||
98 | * standard SS variable. |
||
99 | * |
||
100 | * @var array |
||
101 | */ |
||
102 | private static $allowed_actions = array( |
||
0 ignored issues
–
show
|
|||
103 | 'debug' => 'ADMIN', |
||
104 | 'filterforgroup' => true, |
||
105 | 'ProductSearchForm' => true, |
||
106 | 'searchresults' => true, |
||
107 | 'resetfilter' => true, |
||
108 | ); |
||
109 | |||
110 | public function init() |
||
111 | { |
||
112 | parent::init(); |
||
113 | $array = $this->searchResultsArrayFromSession(); |
||
114 | if (count($array) > 1) { |
||
115 | $this->isSearchResults = true; |
||
116 | } |
||
117 | } |
||
118 | |||
119 | /** |
||
120 | * returns child product groups for use in |
||
121 | * 'in this section'. For example the vegetable Product Group |
||
122 | * May have listed here: Carrot, Cabbage, etc... |
||
123 | * |
||
124 | * @return ArrayList (ProductGroups) |
||
0 ignored issues
–
show
|
|||
125 | */ |
||
126 | public function MenuChildGroups() |
||
127 | { |
||
128 | return; |
||
129 | } |
||
130 | |||
131 | public function ProductsShowable($extraFilter = null, $alternativeSort = null, $alternativeFilterKey = '') |
||
0 ignored issues
–
show
The return type could not be reliably inferred; please add a
@return annotation.
Our type inference engine in quite powerful, but sometimes the code does not
provide enough clues to go by. In these cases we request you to add a ![]() |
|||
132 | { |
||
133 | $alternativeSort = $this->getSearchResultsDefaultSort($this->searchResultsArrayFromSession(), $alternativeSort); |
||
134 | |||
135 | $this->allProducts = parent::ProductsShowable($extraFilter, $alternativeSort, $alternativeFilterKey); |
||
136 | |||
137 | return $this->allProducts; |
||
138 | } |
||
139 | /** |
||
140 | * The link that Google et al. need to index. |
||
141 | * @return string |
||
142 | */ |
||
143 | public function CanonicalLink() |
||
144 | { |
||
145 | $link = $this->Link(); |
||
146 | $this->extend('UpdateCanonicalLink', $link); |
||
147 | |||
148 | return $link; |
||
149 | } |
||
150 | } |
||
151 |