sunnysideup /
silverstripe-ecommerce
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 | |||
| 4 | /** |
||
| 5 | * This field shows the admin (and maybe the customer) where the Order is at (which orderstep). |
||
| 6 | * |
||
| 7 | * @authors: Nicolaas [at] Sunny Side Up .co.nz |
||
| 8 | * @package: ecommerce |
||
| 9 | * @sub-package: forms |
||
| 10 | * @inspiration: Silverstripe Ltd, Jeremy |
||
| 11 | **/ |
||
| 12 | class OrderStepField extends DatalessField |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | protected $content; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param string $name |
||
| 21 | * @param Order $order |
||
| 22 | * @param Member $member |
||
|
0 ignored issues
–
show
|
|||
| 23 | */ |
||
| 24 | public function __construct($name, Order $order, Member $member = null) |
||
| 25 | { |
||
| 26 | if (!$member) { |
||
| 27 | $member = $order->Member(); |
||
|
0 ignored issues
–
show
|
|||
| 28 | } |
||
| 29 | if (!$member) { |
||
| 30 | $member = new Member(); |
||
| 31 | } |
||
| 32 | $orderSteps = OrderStep::get(); |
||
| 33 | $where = '"HideStepFromCustomer" = 0'; |
||
|
0 ignored issues
–
show
$where is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the Loading history...
|
|||
| 34 | $currentStep = $order->CurrentStepVisibleToCustomer(); |
||
|
0 ignored issues
–
show
$currentStep is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the Loading history...
|
|||
| 35 | if ($member->IsShopAdmin()) { |
||
| 36 | $currentStep = $order->MyStep(); |
||
| 37 | } else { |
||
| 38 | $currentStep = $order->CurrentStepVisibleToCustomer(); |
||
| 39 | $orderSteps = $orderSteps |
||
| 40 | ->filter(array('HideStepFromCustomer' => 0)); |
||
| 41 | } |
||
| 42 | $future = false; |
||
| 43 | $html = ' |
||
| 44 | <div class="orderStepField"> |
||
| 45 | <ol>'; |
||
| 46 | if ($orderSteps->count()) { |
||
| 47 | foreach ($orderSteps as $orderStep) { |
||
| 48 | if ($orderStep->HideFromEveryone()) { |
||
| 49 | continue; |
||
| 50 | } |
||
| 51 | $description = ''; |
||
| 52 | if ($member->IsShopAdmin()) { |
||
| 53 | if ($orderStep->Description) { |
||
| 54 | $description = ' title="'.Convert::raw2att($orderStep->Description).'" '; |
||
| 55 | } |
||
| 56 | } |
||
| 57 | $class = ''; |
||
| 58 | if ($orderStep->ID == $currentStep->ID) { |
||
| 59 | $future = true; |
||
| 60 | $class .= ' current'; |
||
| 61 | } elseif ($future) { |
||
| 62 | $class .= ' todo'; |
||
| 63 | } else { |
||
| 64 | $class .= ' done'; |
||
| 65 | } |
||
| 66 | $html .= '<li class="'.$class.'" '.$description.'><a href="'.$orderStep->CMSEditLink().'">'.$orderStep->Title.'</a></li>'; |
||
| 67 | } |
||
| 68 | } else { |
||
| 69 | $html .= 'no steps'; |
||
| 70 | } |
||
| 71 | $html .= '</ol><div class="clear"></div></div>'; |
||
| 72 | $this->content = $html; |
||
| 73 | Requirements::themedCSS('OrderStepField', 'ecommerce'); |
||
| 74 | parent::__construct($name); |
||
| 75 | } |
||
| 76 | |||
| 77 | /** |
||
| 78 | * standard SS method. |
||
| 79 | * |
||
| 80 | * @param array $properties |
||
| 81 | * |
||
| 82 | * @return HTML |
||
| 83 | */ |
||
| 84 | public function FieldHolder($properties = array()) |
||
| 85 | { |
||
| 86 | return is_object($this->content) ? $this->content->forTemplate() : $this->content; |
||
| 87 | } |
||
| 88 | |||
| 89 | /** |
||
| 90 | * standard SS method. |
||
| 91 | * |
||
| 92 | * @param array $properties |
||
| 93 | * |
||
| 94 | * @return HTML |
||
| 95 | */ |
||
| 96 | public function Field($properties = array()) |
||
| 97 | { |
||
| 98 | return $this->FieldHolder(); |
||
| 99 | } |
||
| 100 | |||
| 101 | /** |
||
| 102 | * Sets the content of this field to a new value. |
||
| 103 | * |
||
| 104 | * @param string $content |
||
| 105 | */ |
||
| 106 | public function setContent($content) |
||
| 107 | { |
||
| 108 | $this->content = $content; |
||
| 109 | } |
||
| 110 | |||
| 111 | /** |
||
| 112 | * @return string |
||
| 113 | */ |
||
| 114 | public function getContent() |
||
| 115 | { |
||
| 116 | return $this->content; |
||
| 117 | } |
||
| 118 | |||
| 119 | /** |
||
| 120 | * Synonym of {@link setContent()} so that LiteralField is more compatible with other field types. |
||
| 121 | * |
||
| 122 | * @param mixed |
||
| 123 | */ |
||
| 124 | public function setValue($value) |
||
| 125 | { |
||
| 126 | return $this->setContent($value); |
||
| 127 | } |
||
| 128 | |||
| 129 | /** |
||
| 130 | * standard SS method. |
||
| 131 | * |
||
| 132 | * @return Field |
||
|
0 ignored issues
–
show
|
|||
| 133 | */ |
||
| 134 | public function performReadonlyTransformation() |
||
| 135 | { |
||
| 136 | $clone = clone $this; |
||
| 137 | $clone->setReadonly(true); |
||
| 138 | |||
| 139 | return $clone; |
||
| 140 | } |
||
| 141 | } |
||
| 142 |
This check looks for
@paramannotations where the type inferred by our type inference engine differs from the declared type.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.