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 | * Elgg autosubscribegroup plugin |
||
5 | * Allows admins to select groups for new users to automatically join |
||
6 | * |
||
7 | * @package autosubscribegroups |
||
8 | * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 |
||
9 | * @author RONNEL Jérémy |
||
10 | * @author Mark Wooff <[email protected]> |
||
11 | * @copyright (c) Elbee 2008 |
||
12 | * @link /www.notredeco.com |
||
13 | * |
||
14 | * for Elgg 1.9 onwards by iionly ([email protected]) |
||
15 | */ |
||
16 | |||
17 | /** |
||
18 | * Init |
||
19 | */ |
||
20 | elgg_register_event_handler('init', 'system', 'gc_autosubscribegroup_init'); |
||
21 | |||
22 | function gc_autosubscribegroup_init() { |
||
23 | // Listen to user registration |
||
24 | elgg_register_event_handler('create', 'user', 'gc_autosubscribegroup_join', 502); |
||
25 | elgg_register_event_handler('create', 'group', 'gc_autosubscribegroup_create', 502); |
||
26 | |||
27 | elgg_register_ajax_view("organization_form/form"); |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Autosubscribe new users upon registration |
||
32 | * Autosubscribe new users by organization upon registration |
||
33 | */ |
||
34 | function gc_autosubscribegroup_join($event, $object_type, $object) { |
||
35 | if( ($object instanceof ElggUser) && ($event == 'create') && ($object_type == 'user') ){ |
||
36 | //retrieve group ids from plugin |
||
37 | $autogroups = elgg_get_plugin_setting('autogroups', 'gc_autosubscribegroup'); |
||
38 | $autogroups = split(',', $autogroups); |
||
39 | |||
40 | //for each group id |
||
41 | View Code Duplication | foreach($autogroups as $group){ |
|
42 | $ia = elgg_set_ignore_access(true); |
||
43 | $groupEnt = get_entity($group); |
||
44 | elgg_set_ignore_access($ia); |
||
45 | //if group exists, submit to group |
||
46 | if( $groupEnt ){ |
||
47 | //join group succeed? |
||
48 | if( $groupEnt->join($object) ){ |
||
49 | add_entity_relationship($object->guid, 'cp_subscribed_to_email', $groupEnt->guid); |
||
50 | add_entity_relationship($object->guid, 'cp_subscribed_to_site_mail', $groupEnt->guid); |
||
51 | |||
52 | // Remove any invite or join request flags |
||
53 | elgg_delete_metadata(array('guid' => $object->guid, 'metadata_name' => 'group_invite', 'metadata_value' => $groupEnt->guid, 'limit' => false)); |
||
54 | elgg_delete_metadata(array('guid' => $object->guid, 'metadata_name' => 'group_join_request', 'metadata_value' => $groupEnt->guid, 'limit' => false)); |
||
55 | } |
||
56 | } |
||
57 | } |
||
58 | |||
59 | //retrieve group ids from plugin |
||
60 | $organizationgroups = elgg_get_plugin_setting('organizationgroups', 'gc_autosubscribegroup'); |
||
61 | $organizationgroups = json_decode($organizationgroups, true); |
||
62 | |||
63 | $meta_fields = array('user_type', 'federal', 'institution', 'university', 'college', 'provincial', 'ministry', 'municipal', 'international', 'ngo', 'community', 'business', 'media', 'retired', 'other'); |
||
64 | foreach($meta_fields as $field){ |
||
65 | $$field = get_input($field); |
||
66 | } |
||
67 | |||
68 | //for each group id |
||
69 | foreach($organizationgroups as $group => $organizations){ |
||
70 | $ia = elgg_set_ignore_access(true); |
||
71 | $groupEnt = get_entity($group); |
||
72 | elgg_set_ignore_access($ia); |
||
73 | |||
74 | foreach($organizations as $value){ |
||
75 | $match = false; |
||
76 | $user_type2 = $institution2 = $organization2 = ""; |
||
77 | if( is_array($value) ){ |
||
78 | $user_type2 = array_keys($value)[0]; |
||
79 | $organization2 = array_values($value)[0]; |
||
80 | } |
||
81 | View Code Duplication | if( is_array($organization2) ){ |
|
82 | $temp = $organization2; |
||
83 | $institution2 = array_keys($temp)[0]; |
||
84 | $organization2 = array_values($temp)[0]; |
||
85 | } |
||
86 | |||
87 | if( $user_type == $user_type2 ){ |
||
0 ignored issues
–
show
|
|||
88 | if( empty(trim($organization2)) ){ |
||
89 | $match = true; |
||
90 | } else if( $$user_type == trim($organization2) ){ |
||
0 ignored issues
–
show
The variable
$user_type does not exist. Did you mean $user_type2 ?
This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name. The variable may have been renamed without also renaming all references. ![]() |
|||
91 | $match = true; |
||
92 | } else if( $institution == $institution2 ){ |
||
0 ignored issues
–
show
The variable
$institution does not exist. Did you mean $institution2 ?
This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name. The variable may have been renamed without also renaming all references. ![]() |
|||
93 | if($university == $organization2 || $college == $organization2){ |
||
0 ignored issues
–
show
|
|||
94 | $match = true; |
||
95 | } |
||
96 | } else if( $provincial == $institution2 ){ |
||
0 ignored issues
–
show
|
|||
97 | if($ministry == $organization2){ |
||
0 ignored issues
–
show
|
|||
98 | $match = true; |
||
99 | } |
||
100 | } |
||
101 | if( $match ){ |
||
102 | if( $groupEnt ){ |
||
103 | //join group succeed? |
||
104 | if( $groupEnt->join($object) ){ |
||
105 | add_entity_relationship($object->guid, 'cp_subscribed_to_email', $groupEnt->guid); |
||
106 | add_entity_relationship($object->guid, 'cp_subscribed_to_site_mail', $groupEnt->guid); |
||
107 | |||
108 | // Remove any invite or join request flags |
||
109 | elgg_delete_metadata(array('guid' => $object->guid, 'metadata_name' => 'group_invite', 'metadata_value' => $groupEnt->guid, 'limit' => false)); |
||
110 | elgg_delete_metadata(array('guid' => $object->guid, 'metadata_name' => 'group_join_request', 'metadata_value' => $groupEnt->guid, 'limit' => false)); |
||
111 | } |
||
112 | } |
||
113 | } |
||
114 | } |
||
115 | } |
||
116 | } |
||
117 | } |
||
118 | } |
||
119 | |||
120 | /** |
||
121 | * Autosubscribe group admins upon group creation |
||
122 | */ |
||
123 | function gc_autosubscribegroup_create($event, $object_type, $object) { |
||
124 | if( ($object instanceof ElggGroup) && ($event == 'create') && ($object_type == 'group') ){ |
||
125 | //retrieve group ids from plugin |
||
126 | $groups = elgg_get_plugin_setting('admingroups', 'gc_autosubscribegroup'); |
||
127 | $groups = split(',', $groups); |
||
128 | |||
129 | //for each group id |
||
130 | View Code Duplication | foreach($groups as $groupId){ |
|
131 | $ia = elgg_set_ignore_access(true); |
||
132 | $groupEnt = get_entity($groupId); |
||
133 | elgg_set_ignore_access($ia); |
||
134 | $userEnt = get_user($object->owner_guid); |
||
135 | //if group exists, submit to group |
||
136 | if( $groupEnt ){ |
||
137 | //join group succeed? |
||
138 | if( $groupEnt->join($userEnt) ){ |
||
139 | add_entity_relationship($userEnt->guid, 'cp_subscribed_to_email', $groupEnt->guid); |
||
140 | add_entity_relationship($userEnt->guid, 'cp_subscribed_to_site_mail', $groupEnt->guid); |
||
141 | |||
142 | // Remove any invite or join request flags |
||
143 | elgg_delete_metadata(array('guid' => $userEnt->guid, 'metadata_name' => 'group_invite', 'metadata_value' => $groupEnt->guid, 'limit' => false)); |
||
144 | elgg_delete_metadata(array('guid' => $userEnt->guid, 'metadata_name' => 'group_join_request', 'metadata_value' => $groupEnt->guid, 'limit' => false)); |
||
145 | } |
||
146 | } |
||
147 | } |
||
148 | } |
||
149 | } |
||
150 |
This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.
The variable may have been renamed without also renaming all references.