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 | * This file is part of Gitamin. |
||
5 | * |
||
6 | * Copyright (C) 2015-2016 The Gitamin Team |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace Gitamin\Http\Controllers; |
||
13 | |||
14 | use AltThree\Validator\ValidationException; |
||
15 | use Gitamin\Commands\Owner\AddOwnerCommand; |
||
16 | use Gitamin\Commands\Owner\UpdateOwnerCommand; |
||
17 | use Gitamin\Models\Group; |
||
18 | use Gitamin\Models\Owner; |
||
19 | use Gitamin\Models\Project; |
||
20 | use Illuminate\Database\QueryException; |
||
21 | use Illuminate\Support\Facades\Auth; |
||
22 | use Illuminate\Support\Facades\Redirect; |
||
23 | use Illuminate\Support\Facades\Request; |
||
24 | use Illuminate\Support\Facades\View; |
||
25 | |||
26 | class GroupsController extends Controller |
||
27 | { |
||
28 | /** |
||
29 | * Shows the project groups view. |
||
30 | * |
||
31 | * @return \Illuminate\View\View |
||
32 | */ |
||
33 | public function indexAction() |
||
34 | { |
||
35 | return View::make('groups.index') |
||
36 | ->withPageTitle(trans_choice('gitamin.groups.groups', 2).' - '.trans('dashboard.dashboard')) |
||
37 | ->withGroups(Group::get()) |
||
38 | ->withSubMenu($this->subMenu); |
||
0 ignored issues
–
show
|
|||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Shows the group view. |
||
43 | * |
||
44 | * @return \Illuminate\View\View |
||
45 | */ |
||
46 | public function showAction($path) |
||
47 | { |
||
48 | $group = Group::findByPath($path); |
||
49 | |||
50 | return View::make('groups.show') |
||
51 | ->withPageTitle($group->name) |
||
0 ignored issues
–
show
The property
name does not exist on object<Gitamin\Models\User> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
52 | ->withGroup($group); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Shows the new project view. |
||
57 | * |
||
58 | * @return \Illuminate\View\View |
||
59 | */ |
||
60 | public function newAction() |
||
61 | { |
||
62 | return View::make('groups.new') |
||
63 | ->withPageTitle(trans('dashboard.groups.new.title').' - '.trans('dashboard.dashboard')); |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * Creates a new project. |
||
68 | * |
||
69 | * @return \Illuminate\Http\RedirectResponse |
||
70 | */ |
||
71 | public function createAction() |
||
72 | { |
||
73 | $groupData = Request::get('group'); |
||
74 | $groupData['type'] = 'group'; |
||
75 | $groupData['user_id'] = Auth::user()->id; |
||
76 | try { |
||
77 | $group = $this->dispatchFromArray(AddOwnerCommand::class, $groupData); |
||
0 ignored issues
–
show
$group 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 ![]() |
|||
78 | } catch (ValidationException $e) { |
||
79 | return Redirect::route('groups.new') |
||
80 | ->withInput(Request::all()) |
||
81 | ->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('gitamin.groups.add.failure'))) |
||
82 | ->withErrors($e->getMessageBag()); |
||
83 | } catch (QueryException $e) { |
||
84 | return Redirect::route('groups.new') |
||
85 | ->withInput(Request::all()) |
||
86 | ->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('gitamin.groups.add.failure'))) |
||
87 | ->withErrors('Path has been used'); |
||
88 | } |
||
89 | |||
90 | return Redirect::route('dashboard.groups.index') |
||
91 | ->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('gitamin.groups.add.success'))); |
||
92 | } |
||
93 | |||
94 | /** |
||
95 | * Shows the edit project namespace view. |
||
96 | * |
||
97 | * @param \Gitamin\Models\Owner $namespace |
||
0 ignored issues
–
show
There is no parameter named
$namespace . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
98 | * |
||
99 | * @return \Illuminate\View\View |
||
100 | */ |
||
101 | public function editAction($path) |
||
102 | { |
||
103 | $group = Group::findByPath($path); |
||
104 | |||
105 | return View::make('groups.edit') |
||
106 | ->withPageTitle(trans('gitamin.groups.edit.title').' - '.trans('dashboard.dashboard')) |
||
107 | ->withGroup($group); |
||
108 | } |
||
109 | |||
110 | /** |
||
111 | * Updates a project namespace. |
||
112 | * |
||
113 | * @param \Gitamin\Models\Owner $namespace |
||
0 ignored issues
–
show
There is no parameter named
$namespace . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
114 | * |
||
115 | * @return \Illuminate\Http\RedirectResponse |
||
116 | */ |
||
117 | View Code Duplication | public function updateAction($path) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
118 | { |
||
119 | $groupData = Request::get('group'); |
||
120 | $group = Owner::where('path', '=', $path)->first(); |
||
121 | try { |
||
122 | $groupData['owner'] = $group; |
||
123 | $groupData['user_id'] = Auth::user()->id; |
||
124 | $group = $this->dispatchFromArray(UpdateOwnerCommand::class, $groupData); |
||
125 | } catch (ValidationException $e) { |
||
126 | return Redirect::route('groups.group_edit', ['owner' => $group->path]) |
||
127 | ->withInput(Request::all()) |
||
128 | ->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('gitamin.groups.edit.failure'))) |
||
129 | ->withErrors($e->getMessageBag()); |
||
130 | } |
||
131 | |||
132 | return Redirect::route('groups.group_edit', ['owner' => $group->path]) |
||
133 | ->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('gitamin.groups.edit.success'))); |
||
134 | } |
||
135 | } |
||
136 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: