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 | if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
||
3 | |||
4 | class SecurityGroupMessage extends Basic { |
||
5 | var $new_schema = true; |
||
6 | var $module_dir = 'SecurityGroups'; |
||
7 | var $object_name = 'SecurityGroupMessage'; |
||
8 | var $table_name = 'securitygroups_message'; |
||
9 | var $importable = false; |
||
10 | |||
11 | var $id; |
||
12 | var $name; |
||
13 | var $date_entered; |
||
14 | var $date_modified; |
||
15 | var $modified_user_id; |
||
16 | var $modified_by_name; |
||
17 | var $created_by; |
||
18 | var $created_by_name; |
||
19 | var $description; |
||
20 | var $deleted; |
||
21 | var $created_by_link; |
||
22 | var $modified_user_link; |
||
23 | |||
24 | |||
25 | var $additional_column_fields = Array(); |
||
26 | var $field_defs = array ( |
||
27 | 'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'') |
||
28 | , 'name'=>array('name' =>'name', 'type' =>'varchar', 'len'=>'255', ) |
||
29 | , 'date_entered'=>array ('name' => 'date_entered','type' => 'datetime') |
||
30 | , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime') |
||
31 | , 'modified_user_id'=>array('name' =>'modified_user_id', 'type' =>'char', 'len'=>'36',) |
||
32 | , 'created_by'=>array('name' =>'created_by', 'type' =>'char', 'len'=>'36',) |
||
33 | , 'description'=>array('name' =>'description', 'type' =>'text', 'len'=>'',) |
||
34 | , 'deleted'=>array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'default'=>'0', 'required'=>true) |
||
35 | , 'securitygroup_id'=>array('name' =>'securitygroup_id', 'type' =>'char', 'len'=>'36',) |
||
36 | ); |
||
37 | |||
38 | |||
39 | function __construct(){ |
||
40 | parent::__construct(); |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
||
45 | */ |
||
46 | function SecurityGroupMessage(){ |
||
47 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
||
48 | if(isset($GLOBALS['log'])) { |
||
49 | $GLOBALS['log']->deprecated($deprecatedMessage); |
||
50 | } |
||
51 | else { |
||
52 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
||
53 | } |
||
54 | self::__construct(); |
||
55 | } |
||
56 | |||
57 | |||
58 | |||
59 | function get_list_view_data(){ |
||
60 | $data = parent::get_list_view_data(); |
||
61 | $delete = ''; |
||
62 | |||
63 | $group_owner = false; |
||
64 | $securitygroup_name = ""; |
||
65 | if(empty($data['SECURITYGROUP_ID'])) { |
||
66 | $securitygroup_name = "All"; |
||
67 | } else { |
||
68 | require_once('modules/SecurityGroups/SecurityGroup.php'); |
||
69 | $securitygroup = new SecurityGroup(); |
||
70 | $securitygroup->retrieve($data['SECURITYGROUP_ID']); |
||
71 | $securitygroup_name = $securitygroup->name; |
||
72 | |||
73 | if($securitygroup->assigned_user_id == $GLOBALS['current_user']->id) { |
||
74 | $group_owner = true; |
||
75 | } |
||
76 | } |
||
77 | |||
78 | if(is_admin($GLOBALS['current_user']) || $data['CREATED_BY'] == $GLOBALS['current_user']->id || $group_owner) { |
||
79 | $delete = SugarThemeRegistry::current()->getImage( 'delete_inline', 'width="12" height="12" border="0" align="absmiddle" style="vertical-align: bottom;" onclick=\'Message.deleteMessage("'. $data['ID'] . '", "{this.id}")\'',null,null,'.gif',''); |
||
80 | } |
||
81 | |||
82 | $username = ""; |
||
83 | if(empty($data['CREATED_BY'])) { |
||
84 | $username = "Unknown"; |
||
85 | } else { |
||
86 | require_once('modules/Users/User.php'); |
||
87 | $user = new User(); |
||
88 | $user->retrieve($data['CREATED_BY']); |
||
89 | $username = $user->user_name; |
||
90 | } |
||
91 | |||
92 | $data['NAME'] = $data['DESCRIPTION']; |
||
93 | $data['NAME'] = '<div class="list view" style="padding:5px;border:none;">' . html_entity_decode($data['NAME']); |
||
94 | $data['NAME'] .= '<div class="byLineBox" style="padding-top: 2px"><span class="byLineLeft">'.$username.' ['.$securitygroup_name.']'; |
||
95 | $data['NAME'] .= ' </span><span style="cursor: pointer;" class="byLineRight"> '. $this->getTimeLapse($data['DATE_ENTERED']) . ' ' .$delete. '</span></div>'; |
||
96 | return $data ; |
||
97 | } |
||
98 | |||
99 | |||
100 | static function saveMessage($text, $securitygroup_id) { |
||
101 | //if no security group id then must be admin. Otherwise, make sure the user is a member of the group |
||
102 | global $current_user; |
||
103 | if(empty($securitygroup_id) && !is_admin($current_user)) { |
||
104 | return; |
||
105 | } else if(empty($securitygroup_id)) { |
||
106 | $securitygroup_id = null; //6.4.0 |
||
107 | } |
||
108 | $message = new SecurityGroupMessage(); |
||
109 | if(empty($text)) return; // || !$feed->ACLAccess('save', true) )return; |
||
110 | |||
111 | $text = strip_tags($text); |
||
112 | $message->name = ''; |
||
113 | $message->description = $text; |
||
114 | $message->securitygroup_id = $securitygroup_id; |
||
115 | $message->save(); |
||
116 | } |
||
117 | |||
118 | function getTimeLapse($startDate) |
||
119 | { |
||
120 | $startDate = $GLOBALS['timedate']->to_db($startDate); |
||
121 | $start = array(); |
||
122 | preg_match('/(\d+)\-(\d+)\-(\d+) (\d+)\:(\d+)\:(\d+)/', $startDate, $start); |
||
123 | $end = gmdate('Y-m-d H:i:s'); |
||
124 | $start_time = gmmktime($start[4],$start[5], $start[6], $start[2], $start[3], $start[1] ); |
||
125 | $seconds = time()- $start_time; |
||
126 | $minutes = $seconds/60; |
||
127 | $seconds = $seconds % 60; |
||
128 | $hours = floor( $minutes / 60); |
||
129 | $minutes = $minutes % 60; |
||
130 | $days = floor( $hours / 24); |
||
131 | $hours = $hours % 24; |
||
132 | $weeks = floor( $days / 7); |
||
133 | $days = $days % 7; |
||
134 | $result = ''; |
||
135 | if($weeks == 1){ |
||
136 | $result = translate('LBL_TIME_LAST_WEEK','SugarFeed').' '; |
||
137 | return $result; |
||
138 | }else if($weeks > 1){ |
||
139 | $result .= $weeks . ' '.translate('LBL_TIME_WEEKS','SugarFeed').' '; |
||
140 | if($days > 0) { |
||
141 | $result .= $days . ' '.translate('LBL_TIME_DAYS','SugarFeed').' '; |
||
142 | } |
||
143 | }else{ |
||
144 | if($days == 1){ |
||
145 | $result = translate('LBL_TIME_YESTERDAY','SugarFeed').' '; |
||
146 | return $result; |
||
147 | }else if($days > 1){ |
||
148 | $result .= $days . ' '. translate('LBL_TIME_DAYS','SugarFeed').' '; |
||
149 | }else{ |
||
150 | if($hours == 1) { |
||
151 | $result .= $hours . ' '.translate('LBL_TIME_HOUR','SugarFeed').' '; |
||
152 | } else { |
||
153 | $result .= $hours . ' '.translate('LBL_TIME_HOURS','SugarFeed').' '; |
||
154 | } |
||
155 | if($hours < 6){ |
||
156 | if($minutes == 1) { |
||
157 | $result .= $minutes . ' ' . translate('LBL_TIME_MINUTE','SugarFeed'). ' '; |
||
158 | } else { |
||
159 | $result .= $minutes . ' ' . translate('LBL_TIME_MINUTES','SugarFeed'). ' '; |
||
160 | } |
||
161 | } |
||
162 | if($hours == 0 && $minutes == 0) { |
||
163 | if($seconds == 1 ) { |
||
164 | $result = $seconds . ' ' . translate('LBL_TIME_SECOND','SugarFeed'); |
||
165 | } else { |
||
166 | $result = $seconds . ' ' . translate('LBL_TIME_SECONDS','SugarFeed'); |
||
167 | } |
||
168 | } |
||
169 | } |
||
170 | } |
||
171 | return $result . ' ' . translate('LBL_TIME_AGO','SugarFeed'); |
||
172 | |||
173 | |||
174 | |||
175 | } |
||
176 | |||
177 | function bean_implements($interface){ |
||
178 | switch($interface){ |
||
179 | case 'ACL':return false; |
||
0 ignored issues
–
show
Terminating statement must be on a line by itself
As per the PSR-2 coding standard, the switch ($expr) {
case "A":
doSomething();
break; //wrong
case "B":
doSomething();
break; //right
case "C:":
doSomething();
return true; //right
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
180 | } |
||
181 | return false; |
||
182 | } |
||
183 | |||
184 | } |
||
185 | ?> |
According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.