aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmod/events.php31
-rw-r--r--mod/post.php2
-rw-r--r--version.inc2
-rw-r--r--view/theme/redbasic/css/style.css2
-rwxr-xr-xview/tpl/event.tpl1
5 files changed, 35 insertions, 3 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);
diff --git a/version.inc b/version.inc
index 607466176..cdb667e3f 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2015-02-14.944
+2015-02-15.945
diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css
index 6a46d7429..5b24ab731 100644
--- a/view/theme/redbasic/css/style.css
+++ b/view/theme/redbasic/css/style.css
@@ -992,7 +992,7 @@ nav .acpopup {
margin-bottom: 10px;
}
-.edit-event-link, .plink-event-link {
+.edit-event-link, .plink-event-link, .drop-event-link {
float: left;
margin-top: 4px;
margin-right: 4px;
diff --git a/view/tpl/event.tpl b/view/tpl/event.tpl
index f0e00bd2c..5dfc91ebe 100755
--- a/view/tpl/event.tpl
+++ b/view/tpl/event.tpl
@@ -8,6 +8,7 @@
<div class="event-buttons">
{{if $event.item.plink}}<a href="{{$event.plink.0}}" title="{{$event.plink.1}}" class="plink-event-link"><i class="icon-external-link btn btn-default" ></i></a>{{/if}}
{{if $event.edit}}<a href="{{$event.edit.0}}" title="{{$event.edit.1}}" class="edit-event-link"><i class="icon-pencil btn btn-default"></i></a>{{/if}}
+ {{if $event.drop}}<a href="{{$event.drop.0}}" title="{{$event.drop.1}}" class="drop-event-link"><i class="icon-trash btn btn-default"></i></a>{{/if}}
</div>
</div>
<div class="clear"></div>