forked from nikrou/eventHandler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_services.php
More file actions
50 lines (44 loc) · 1.27 KB
/
Copy path_services.php
File metadata and controls
50 lines (44 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of eventHandler, a plugin for Dotclear 2.
#
# Copyright(c) 2014-2015 Nicolas Roudaire <nikrou77@gmail.com> http://www.nikrou.net
#
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
# contact@jcdenis.fr http://jcd.lv
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')){return;}
class eventHandlerRestMethods
{
public static function unbindEventOfPost($core,$get)
{
$core->blog->settings->addNamespace('eventHandler');
$post_id = isset($get['postId']) ? $get['postId'] : null;
$event_id = isset($get['eventId']) ? $get['eventId'] : null;
if ($post_id === null)
{
throw new Exception(__('No such post ID'));
}
if ($event_id === null)
{
throw new Exception(__('No such event ID'));
}
try
{
$core->meta->delPostMeta($post_id,'eventhandler',$event_id);
}
catch (Exception $e)
{
throw new Exception(__('An error occured when trying de unbind event'));
}
$rsp = new xmlTag();
$rsp->value(__('Event removed from post'));
return $rsp;
}
}