lost ability to delete events
This commit is contained in:
parent
0d9508d5ef
commit
0249fbb7e6
@ -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),
|
||||
|
@ -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);
|
||||
|
@ -1 +1 @@
|
||||
2015-02-14.944
|
||||
2015-02-15.945
|
||||
|
@ -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;
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user