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 | * River item class. |
||
4 | * |
||
5 | * @package Elgg.Core |
||
6 | * @subpackage Core |
||
7 | * |
||
8 | * @property-read int $id The unique identifier (read-only) |
||
9 | * @property-read int $subject_guid The GUID of the actor |
||
10 | * @property-read int $object_guid The GUID of the object |
||
11 | * @property-read int $target_guid The GUID of the object's container |
||
12 | * @property-read int $annotation_id The ID of the annotation involved in the action |
||
13 | * @property-read string $type The type of one of the entities involved in the action |
||
14 | * @property-read string $subtype The subtype of one of the entities involved in the action |
||
15 | * @property-read string $action_type The name of the action |
||
16 | * @property-read string $view The view for displaying this river item |
||
17 | * @property-read int $access_id The visibility of the river item |
||
18 | * @property-read int $posted UNIX timestamp when the action occurred |
||
19 | * @property-read string $enabled Is the river item enabled yes|no |
||
20 | */ |
||
21 | class ElggRiverItem { |
||
22 | public $id; |
||
23 | public $subject_guid; |
||
24 | public $object_guid; |
||
25 | public $target_guid; |
||
26 | public $annotation_id; |
||
27 | public $type; |
||
28 | public $subtype; |
||
29 | public $action_type; |
||
30 | public $access_id; |
||
31 | public $view; |
||
32 | public $posted; |
||
33 | public $enabled; |
||
34 | |||
35 | /** |
||
36 | * Construct a river item object given a database row. |
||
37 | * |
||
38 | * @param \stdClass $object Object obtained from database |
||
39 | */ |
||
40 | public function __construct($object) { |
||
41 | if (!($object instanceof \stdClass)) { |
||
42 | throw new \InvalidParameterException("Invalid input to \ElggRiverItem constructor"); |
||
43 | } |
||
44 | |||
45 | // the casting is to support typed serialization like json |
||
46 | $int_types = array('id', 'subject_guid', 'object_guid', 'target_guid', 'annotation_id', 'access_id', 'posted'); |
||
47 | foreach ($object as $key => $value) { |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
48 | if (in_array($key, $int_types)) { |
||
49 | $this->$key = (int)$value; |
||
50 | } else { |
||
51 | $this->$key = $value; |
||
52 | } |
||
53 | } |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * Get the subject of this river item |
||
58 | * |
||
59 | * @return \ElggEntity |
||
60 | */ |
||
61 | public function getSubjectEntity() { |
||
62 | return get_entity($this->subject_guid); |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * Get the object of this river item |
||
67 | * |
||
68 | * @return \ElggEntity |
||
69 | */ |
||
70 | public function getObjectEntity() { |
||
71 | return get_entity($this->object_guid); |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * Get the target of this river item |
||
76 | * |
||
77 | * @return \ElggEntity |
||
78 | */ |
||
79 | public function getTargetEntity() { |
||
80 | return get_entity($this->target_guid); |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * Get the Annotation for this river item |
||
85 | * |
||
86 | * @return \ElggAnnotation |
||
87 | */ |
||
88 | public function getAnnotation() { |
||
89 | return elgg_get_annotation_from_id($this->annotation_id); |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * Get the view used to display this river item |
||
94 | * |
||
95 | * @return string |
||
96 | */ |
||
97 | public function getView() { |
||
98 | return $this->view; |
||
99 | } |
||
100 | |||
101 | /** |
||
102 | * Get the time this activity was posted |
||
103 | * |
||
104 | * @return int |
||
105 | * @deprecated 1.9 Use getTimePosted() |
||
106 | */ |
||
107 | public function getPostedTime() { |
||
108 | elgg_deprecated_notice("\ElggRiverItem::getPostedTime() deprecated in favor of getTimePosted()", 1.9); |
||
109 | return (int)$this->posted; |
||
110 | } |
||
111 | |||
112 | /** |
||
113 | * Get the time this activity was posted |
||
114 | * |
||
115 | * @return int |
||
116 | */ |
||
117 | public function getTimePosted() { |
||
118 | return (int)$this->posted; |
||
119 | } |
||
120 | |||
121 | /** |
||
122 | * Get the type of the object |
||
123 | * |
||
124 | * This is required for elgg_view_list_item(). All the other data types |
||
125 | * (entities, extenders, relationships) have a type/subtype. |
||
126 | * |
||
127 | * @return string 'river' |
||
128 | */ |
||
129 | public function getType() { |
||
130 | return 'river'; |
||
131 | } |
||
132 | |||
133 | /** |
||
134 | * Get the subtype of the object |
||
135 | * |
||
136 | * This is required for elgg_view_list_item(). |
||
137 | * |
||
138 | * @return string 'item' |
||
139 | */ |
||
140 | public function getSubtype() { |
||
141 | return 'item'; |
||
142 | } |
||
143 | |||
144 | /** |
||
145 | * Get a plain old object copy for public consumption |
||
146 | * |
||
147 | * @return \stdClass |
||
148 | */ |
||
149 | public function toObject() { |
||
150 | $object = new \stdClass(); |
||
151 | $object->id = $this->id; |
||
152 | $object->subject_guid = $this->subject_guid; |
||
153 | $object->object_guid = $this->object_guid; |
||
154 | $object->annotation_id = $this->annotation_id; |
||
155 | $object->read_access = $this->access_id; |
||
156 | $object->action = $this->action_type; |
||
157 | $object->time_posted = date('c', $this->getTimePosted()); |
||
158 | $object->enabled = $this->enabled; |
||
159 | $params = array('item' => $this); |
||
160 | return _elgg_services()->hooks->trigger('to:object', 'river_item', $params, $object); |
||
161 | } |
||
162 | |||
163 | } |
||
164 |