Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F884635
Select.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
797 B
Subscribers
None
Select.php
View Options
<?php
namespace
Zed\Engines\Perso\Events
;
use
InvalidArgumentException
;
use
Perso
;
class
Select
extends
BaseEvent
{
public
function
isTriggered
()
:
bool
{
return
array_key_exists
(
'action'
,
$_GET
)
&&
$_GET
[
'action'
]
==
'perso.select'
;
}
public
function
handle
()
:
void
{
// User has explicitly selected a perso
if
(!
array_key_exists
(
'perso_id'
,
$_GET
))
{
throw
new
InvalidArgumentException
(
"The perso ID is missing from the URL ('perso_id')."
);
}
$perso
=
new
Perso
(
$_GET
[
'perso_id'
]);
if
(
$perso
->
user_id
!==
$this
->
selector
->
user
->
id
)
{
message_die
(
HACK_ERROR
,
"This isn't your perso."
);
}
$this
->
selector
->
selectAndSetPerso
(
$perso
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Apr 6, 10:29 (2 w, 11 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24517
Default Alt Text
Select.php (797 B)
Attached To
rZED Zed
Event Timeline
Log In to Comment