aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rwxr-xr-xmod/events.php31
-rw-r--r--mod/post.php2
2 files changed, 32 insertions, 1 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),
diff --git a/mod/post.php b/mod/post.php
index c90997335..6e35632da 100644
--- a/mod/post.php
+++ b/mod/post.php
@@ -467,7 +467,7 @@ function post_post(&$a) {
* tells us we need to unencapsulate the AES-256-CBC content using the site private key
*/
- if(array_key_exists('iv',$data)) {
+ if($data && array_key_exists('iv',$data)) {
$encrypted_packet = true;
$data = crypto_unencapsulate($data,get_config('system','prvkey'));
logger('mod_zot: decrypt1: ' . $data, LOGGER_DATA);