aboutsummaryrefslogtreecommitdiffstats
path: root/mod/events.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-02-15 16:04:59 -0800
committerfriendica <info@friendica.com>2015-02-15 16:04:59 -0800
commit0249fbb7e6da9de47fb3c091db4e4e296330993a (patch)
treed61a4fb287f369d83027540dc6dd8bedd140c631 /mod/events.php
parent0d9508d5ef929be1da10e2e8c30d755c96f5e160 (diff)
downloadvolse-hubzilla-0249fbb7e6da9de47fb3c091db4e4e296330993a.tar.gz
volse-hubzilla-0249fbb7e6da9de47fb3c091db4e4e296330993a.tar.bz2
volse-hubzilla-0249fbb7e6da9de47fb3c091db4e4e296330993a.zip
lost ability to delete events
Diffstat (limited to 'mod/events.php')
-rwxr-xr-xmod/events.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/mod/events.php b/mod/events.php
index f209dab1d..010f1f7c4 100755
--- a/mod/events.php
+++ b/mod/events.php
@@ -273,6 +273,10 @@ function events_content(&$a) {
$mode = 'add';
$item_id = intval(argv(2));
}
+ if(argc() > 2 && argv(1) === 'drop') {
+ $mode = 'drop';
+ $event_id = argv(2);
+ }
if(argv(1) === 'new') {
$mode = 'new';
$event_id = '';
@@ -412,6 +416,8 @@ function events_content(&$a) {
$last_date = $d;
// FIXME
$edit = (($rr['item_flags'] & ITEM_WALL) ? array($a->get_baseurl().'/events/event/'.$rr['event_hash'],t('Edit event'),'','') : null);
+ $drop = array($a->get_baseurl().'/events/drop/'.$rr['event_hash'],t('Delete event'),'','');
+
$title = strip_tags(html_entity_decode(bbcode($rr['summary']),ENT_QUOTES,'UTF-8'));
if(! $title) {
list($title, $_trash) = explode("<br",bbcode($rr['desc']),2);
@@ -425,6 +431,7 @@ function events_content(&$a) {
'hash' => $rr['event_hash'],
'start'=> $start,
'end' => $end,
+ 'drop' => $drop,
'allDay' => false,
'title' => $title,
@@ -479,6 +486,30 @@ function events_content(&$a) {
}
+ if($mode === 'drop' && $event_id) {
+ $r = q("SELECT * FROM `event` WHERE event_hash = '%s' AND `uid` = %d LIMIT 1",
+ dbesc($event_id),
+ intval(local_channel())
+ );
+ if($r) {
+ $r = q("delete from event where event_hash = '%s' and uid = %d limit 1",
+ dbesc($event_id),
+ intval(local_channel())
+ );
+ if($r) {
+ $r = q("update item set resource_type = '', resource_id = '' where resource_type = 'event' and resource_id = '%s' and uid = %d",
+ dbesc($event_id),
+ intval(local_channel())
+ );
+ info( t('Event removed') . EOL);
+ }
+ else {
+ notice( t('Failed to remove event' ) . EOL);
+ }
+ goaway(z_root() . '/events');
+ }
+ }
+
if($mode === 'edit' && $event_id) {
$r = q("SELECT * FROM `event` WHERE event_hash = '%s' AND `uid` = %d LIMIT 1",
dbesc($event_id),