diff options
-rw-r--r-- | LICENSE | 2 | ||||
-rw-r--r-- | Zotlabs/Daemon/Poller.php | 5 | ||||
-rw-r--r-- | Zotlabs/Module/Events.php | 2 | ||||
-rwxr-xr-x | boot.php | 15 | ||||
-rw-r--r-- | include/acl_selectors.php | 1 | ||||
-rw-r--r-- | include/bbcode.php | 3 | ||||
-rw-r--r-- | include/cli_startup.php | 4 | ||||
-rw-r--r-- | include/event.php | 59 | ||||
-rw-r--r-- | view/js/acl.js | 4 | ||||
-rw-r--r-- | view/php/theme_init.php | 2 | ||||
-rwxr-xr-x | view/tpl/acl_selector.tpl | 4 | ||||
-rw-r--r-- | view/tpl/app.tpl | 2 |
12 files changed, 55 insertions, 48 deletions
@@ -1,4 +1,4 @@ -Copyright (c) 2010-2016 Hubzilla +Copyright (c) 2010-2016 the Hubzilla Community All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/Zotlabs/Daemon/Poller.php b/Zotlabs/Daemon/Poller.php index 278faf3ee..75efbf8f7 100644 --- a/Zotlabs/Daemon/Poller.php +++ b/Zotlabs/Daemon/Poller.php @@ -62,11 +62,6 @@ class Poller { $d = datetime_convert(); - // TODO check to see if there are any cronhooks before wasting a process - - if(! $restart) - Master::Summon(array('Cronhooks')); - // Only poll from those with suitable relationships $abandon_sql = (($abandon_days) diff --git a/Zotlabs/Module/Events.php b/Zotlabs/Module/Events.php index 3440e0727..2b5e239f9 100644 --- a/Zotlabs/Module/Events.php +++ b/Zotlabs/Module/Events.php @@ -232,7 +232,7 @@ class Events extends \Zotlabs\Web\Controller { } if($share) - \Zotlabs\Daemon\Master(array('Notifier','event',$item_id)); + \Zotlabs\Daemon\Master::Summon(array('Notifier','event',$item_id)); } @@ -2346,21 +2346,27 @@ function cert_bad_email() { */ function check_cron_broken() { - $t = get_config('system','lastpollcheck'); + $d = get_config('system','lastcron'); + + if((! $d) || ($d < datetime_convert('UTC','UTC','now - 4 hours'))) { + Zotlabs\Daemon\Master::Summon(array('Cron')); + } + + $t = get_config('system','lastcroncheck'); if(! $t) { // never checked before. Start the timer. - set_config('system','lastpollcheck',datetime_convert()); + set_config('system','lastcroncheck',datetime_convert()); return; } + if($t > datetime_convert('UTC','UTC','now - 3 days')) { // Wait for 3 days before we do anything so as not to swamp the admin with messages return; } - $d = get_config('system','lastpoll'); if(($d) && ($d > datetime_convert('UTC','UTC','now - 3 days'))) { // Scheduled tasks have run successfully in the last 3 days. - set_config('system','lastpollcheck',datetime_convert()); + set_config('system','lastcroncheck',datetime_convert()); return; } @@ -2377,7 +2383,6 @@ function check_cron_broken() { 'From: Administrator' . '@' . App::get_hostname() . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-transfer-encoding: 8bit' ); - set_config('system','lastpollcheck',datetime_convert()); return; } diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 1f97a7a7b..54ea0304b 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -266,7 +266,6 @@ function populate_acl($defaults = null,$show_jotnets = true, $emptyACL_descripti $o = replace_macros($tpl, array( '$showall' => $showall_caption, '$onlyme' => t('Only me'), - '$add_others' => t('Add others'), '$showallOrigin' => $showall_origin, '$showallIcon' => $showall_icon, '$select_label' => t('Who can see this?'), diff --git a/include/bbcode.php b/include/bbcode.php index 1001a4938..f47dc6f2e 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -168,7 +168,7 @@ function bb_parse_app($match) { $app = Zotlabs\Lib\Apps::app_decode($match[1]); if ($app) - return Zotlab\Lib\Apps::app_render($app); + return Zotlabs\Lib\Apps::app_render($app); } function bb_parse_element($match) { @@ -981,6 +981,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) $Text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism",'',$Text); $Text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/ism",'',$Text); $Text = preg_replace("/\[event\-finish\](.*?)\[\/event\-finish\]/ism",'',$Text); + $Text = preg_replace("/\[event\-id\](.*?)\[\/event\-id\]/ism",'',$Text); $Text = preg_replace("/\[event\-location\](.*?)\[\/event\-location\]/ism",'',$Text); $Text = preg_replace("/\[event\-adjust\](.*?)\[\/event\-adjust\]/ism",'',$Text); diff --git a/include/cli_startup.php b/include/cli_startup.php index 1436fe1ef..792598c6c 100644 --- a/include/cli_startup.php +++ b/include/cli_startup.php @@ -8,9 +8,7 @@ function cli_startup() { global $default_timezone; - if(is_null($a)) { - $a = new miniApp; - } + $a = new miniApp; App::init(); diff --git a/include/event.php b/include/event.php index 29ca5bb79..db67dac64 100644 --- a/include/event.php +++ b/include/event.php @@ -175,6 +175,9 @@ function format_event_bbcode($ev) { if($ev['location']) $o .= '[event-location]' . $ev['location'] . '[/event-location]'; + if($ev['event_hash']) + $o .= '[event-id]' . $ev['event_hash'] . '[/event-id]'; + if($ev['adjust']) $o .= '[event-adjust]' . $ev['adjust'] . '[/event-adjust]'; @@ -212,6 +215,9 @@ function bbtoevent($s) { if(preg_match("/\[event\-location\](.*?)\[\/event\-location\]/is",$s,$match)) $ev['location'] = $match[1]; $match = ''; + if(preg_match("/\[event\-id\](.*?)\[\/event\-id\]/is",$s,$match)) + $ev['event_hash'] = $match[1]; + $match = ''; if(preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",$s,$match)) $ev['adjust'] = $match[1]; if(array_key_exists('start',$ev)) { @@ -278,34 +284,41 @@ function event_store_event($arr) { else $arr['event_status_date'] = NULL_DATE; - // Existing event being modified - if($arr['id'] || $arr['event_hash']) { + $existing_event = null; - // has the event actually changed? + if($arr['event_hash']) { + $r = q("SELECT * FROM event WHERE event_hash = '%s' AND uid = %d LIMIT 1", + dbesc($arr['event_hash']), + intval($arr['uid']) + ); + if($r) { + $existing_event = $r[0]; + } + } - if($arr['event_hash']) { - $r = q("SELECT * FROM event WHERE event_hash = '%s' AND uid = %d LIMIT 1", - dbesc($arr['event_hash']), - intval($arr['uid']) - ); + if($arr['id']) { + $r = q("SELECT * FROM event WHERE id = %d AND uid = %d LIMIT 1", + intval($arr['id']), + intval($arr['uid']) + ); + if($r) { + $existing_event = $r[0]; } else { - $r = q("SELECT * FROM event WHERE id = %d AND uid = %d LIMIT 1", - intval($arr['id']), - intval($arr['uid']) - ); + return false; } + } - if(! $r) - return false; - if($r[0]['edited'] === $arr['edited']) { - // Nothing has changed. Return the ID. - return $r[0]; + if($existing_event) { + + if($existing_event['edited'] >= $arr['edited']) { + // Nothing has changed. + return $existing_event; } - $hash = $r[0]['event_hash']; + $hash = $existing_event['event_hash']; // The event changed. Update it. @@ -350,7 +363,7 @@ function event_store_event($arr) { dbesc($arr['allow_gid']), dbesc($arr['deny_cid']), dbesc($arr['deny_gid']), - intval($r[0]['id']), + intval($existing_event['id']), intval($arr['uid']) ); } else { @@ -360,6 +373,8 @@ function event_store_event($arr) { if(array_key_exists('external_id',$arr)) $hash = $arr['external_id']; + elseif(array_key_exists('event_hash',$arr)) + $hash = $arr['event_hash']; else $hash = random_string() . '@' . App::get_hostname(); @@ -436,7 +451,7 @@ function event_addtocal($item_id, $uid) { // is this an edit? - if($item['resource_type'] === 'event') { + if($item['resource_type'] === 'event' && (! $ev['event_hash'])) { $ev['event_hash'] = $item['resource_id']; } @@ -472,7 +487,6 @@ function event_addtocal($item_id, $uid) { if($z) { build_sync_packet($channel['channel_id'],array('event_item' => array(encode_item($sync_item[0],true)),'event' => $z)); } - return true; } } @@ -764,6 +778,9 @@ function event_store_item($arr, $event) { $prefix = ''; // $birthday = false; + if(($event) && array_key_exists('event_hash',$event) && (! array_key_exists('event_hash',$arr))) + $arr['event_hash'] = $event['event_hash']; + if($event['type'] === 'birthday') { if(! is_sys_channel($arr['uid'])) $prefix = t('This event has been added to your calendar.'); diff --git a/view/js/acl.js b/view/js/acl.js index 92a80e3d1..79699c589 100644 --- a/view/js/acl.js +++ b/view/js/acl.js @@ -20,7 +20,6 @@ function ACL(backend_url, preset) { that.onlyme = $("#acl-onlyme"); that.showlimited = $("#acl-showlimited"); that.acl_select = $("#acl-select"); - that.showacl = $("#show-acl"); that.preset = preset; that.self = []; @@ -250,7 +249,6 @@ ACL.prototype.update_view = function(value) { if (that.allow_gid.length === 0 && that.allow_cid.length === 0 && that.deny_gid.length === 0 && that.deny_cid.length === 0) { that.list.hide(); //hide acl-list - that.showacl.hide(); //hide showacl button that.info.show(); //show acl-info that.update_select('public'); @@ -263,7 +261,6 @@ ACL.prototype.update_view = function(value) { // if value != 'onlyme' we should fall through this one else if (that.allow_gid.length === 0 && that.allow_cid.length === 1 && that.allow_cid[0] === that.self[0] && that.deny_gid.length === 0 && that.deny_cid.length === 0 && value === 'onlyme') { that.list.hide(); //hide acl-list if - that.showacl.show(); //show showacl button that.info.hide(); //show acl-info that.update_select('onlyme'); @@ -274,7 +271,6 @@ ACL.prototype.update_view = function(value) { else { that.list.show(); //show acl-list - that.showacl.hide(); //hide showacl button that.info.hide(); //hide acl-info that.update_select('limited'); diff --git a/view/php/theme_init.php b/view/php/theme_init.php index 7c020a51f..648b144b3 100644 --- a/view/php/theme_init.php +++ b/view/php/theme_init.php @@ -21,7 +21,7 @@ head_add_js('spin.js'); head_add_js('jquery.spin.js'); head_add_js('jquery.textinputs.js'); head_add_js('autocomplete.js'); -head_add_js('library/jquery-textcomplete/jquery.textcomplete.min.js'); +head_add_js('library/jquery-textcomplete/jquery.textcomplete.js'); //head_add_js('library/colorbox/jquery.colorbox.js'); head_add_js('library/jquery.timeago.js'); head_add_js('library/readmore.js/readmore.js'); diff --git a/view/tpl/acl_selector.tpl b/view/tpl/acl_selector.tpl index 1711cee8a..60fae0a29 100755 --- a/view/tpl/acl_selector.tpl +++ b/view/tpl/acl_selector.tpl @@ -19,10 +19,6 @@ <option id="acl-showlimited" value="limited">{{$showlimited}}</option> </select> - <div id="show-acl" class="form-group"> - <button type="button" class="btn btn-success form-group" onclick="openClose('acl-list'); closeOpen('show-acl');"><i class="fa fa-user-plus"></i> {{$add_others}}</button> - </div> - {{if $showallOrigin}} <div id="acl-info" class="form-group"> <i class="fa fa-info-circle"></i> {{$showallOrigin}} diff --git a/view/tpl/app.tpl b/view/tpl/app.tpl index 20a1337c7..3e6b71b29 100644 --- a/view/tpl/app.tpl +++ b/view/tpl/app.tpl @@ -14,7 +14,7 @@ <div class="app-tools"> <form action="{{$hosturl}}appman" method="post"> <input type="hidden" name="papp" value="{{$app.papp}}" /> - {{if $install}}<button type="submit" name="install" value="{{$install}}" class="btn btn-default" title="{{$install}}" ><i class="fa fa-arrow-circle-o-down-alt" ></i></button>{{/if}} + {{if $install}}<button type="submit" name="install" value="{{$install}}" class="btn btn-default" title="{{$install}}" ><i class="fa fa-arrow-circle-o-down" ></i></button>{{/if}} {{if $edit}}<input type="hidden" name="appid" value="{{$app.guid}}" /><button type="submit" name="edit" value="{{$edit}}" class="btn btn-default" title="{{$edit}}" ><i class="fa fa-pencil" ></i></button>{{/if}} {{if $delete}}<button type="submit" name="delete" value="{{$delete}}" class="btn btn-default" title="{{$delete}}" ><i class="fa fa-trash-o drop-icons"></i></button>{{/if}} </form> |