diff options
author | zotlabs <mike@macgirvin.com> | 2018-01-21 17:08:39 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-01-21 17:08:39 -0800 |
commit | d4c81d8e0e4cea191009da66c1a4374e6537fc61 (patch) | |
tree | c962a68dbf7874e326f4ca268fe0183ac184ea12 | |
parent | 89aa882c95b4d01bd7bf6ff461c1dcefdedea7bd (diff) | |
parent | 1709dbd376af3171815f25b7055fb41da53924cb (diff) | |
download | volse-hubzilla-d4c81d8e0e4cea191009da66c1a4374e6537fc61.tar.gz volse-hubzilla-d4c81d8e0e4cea191009da66c1a4374e6537fc61.tar.bz2 volse-hubzilla-d4c81d8e0e4cea191009da66c1a4374e6537fc61.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
-rw-r--r-- | Zotlabs/Daemon/Notifier.php | 2 | ||||
-rw-r--r-- | Zotlabs/Lib/ThreadItem.php | 4 | ||||
-rw-r--r-- | Zotlabs/Web/Router.php | 6 | ||||
-rw-r--r-- | Zotlabs/Web/WebServer.php | 75 | ||||
-rw-r--r-- | Zotlabs/Widget/Forums.php | 22 | ||||
-rw-r--r-- | doc/member/member_guide.bb | 17 | ||||
-rw-r--r-- | include/api_zot.php | 24 | ||||
-rwxr-xr-x | include/dba/dba_pdo.php | 4 | ||||
-rw-r--r-- | include/features.php | 26 | ||||
-rw-r--r-- | view/css/widgets.css | 11 | ||||
-rw-r--r-- | view/js/main.js | 24 | ||||
-rwxr-xr-x | view/tpl/comment_item.tpl | 8 | ||||
-rw-r--r-- | view/tpl/notifications_widget.tpl | 23 |
13 files changed, 146 insertions, 100 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index cb1eb7b79..b168db5ae 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -90,8 +90,6 @@ class Notifier { $item_id = $argv[2]; - $extra = (($argc > 3) ? $argv[3] : null); - if(! $item_id) return; diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 748edcdb7..d35d4732a 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -730,9 +730,6 @@ class ThreadItem { $observer = $conv->get_observer(); - $qc = ((local_channel()) ? get_pconfig(local_channel(),'system','qcomment') : null); - $qcomment = (($qc) ? explode("\n",$qc) : null); - $arr = array('comment_buttons' => '','id' => $this->get_id()); call_hooks('comment_buttons',$arr); $comment_buttons = $arr['comment_buttons']; @@ -744,7 +741,6 @@ class ThreadItem { '$type' => (($conv->get_mode() === 'channel') ? 'wall-comment' : 'net-comment'), '$id' => $this->get_id(), '$parent' => $this->get_id(), - '$qcomment' => $qcomment, '$comment_buttons' => $comment_buttons, '$profile_uid' => $conv->get_profile_owner(), '$mylink' => $observer['xchan_url'], diff --git a/Zotlabs/Web/Router.php b/Zotlabs/Web/Router.php index a6b780cdc..fb551e36f 100644 --- a/Zotlabs/Web/Router.php +++ b/Zotlabs/Web/Router.php @@ -38,10 +38,9 @@ class Router { /** * @brief Router constructor. * - * @param[in,out] App &$a * @throws Exception module not found */ - function __construct(&$a) { + function __construct() { $module = \App::$module; $modname = "Zotlabs\\Module\\" . ucfirst($module); @@ -179,9 +178,8 @@ class Router { /** * @brief * - * @param[in,out] App &$a */ - function Dispatch(&$a) { + function Dispatch() { /** * Call module functions diff --git a/Zotlabs/Web/WebServer.php b/Zotlabs/Web/WebServer.php index 9e6af8c4c..5183fb2b0 100644 --- a/Zotlabs/Web/WebServer.php +++ b/Zotlabs/Web/WebServer.php @@ -58,11 +58,10 @@ class WebServer { if((x($_GET,'zid')) && (! \App::$install)) { \App::$query_string = strip_zids(\App::$query_string); if(! local_channel()) { - if ($_SESSION['my_address']!=$_GET['zid']) - { - $_SESSION['my_address'] = $_GET['zid']; - $_SESSION['authenticated'] = 0; - } + if ($_SESSION['my_address']!=$_GET['zid']) { + $_SESSION['my_address'] = $_GET['zid']; + $_SESSION['authenticated'] = 0; + } zid_init(); } } @@ -107,9 +106,43 @@ class WebServer { check_config(); } - //nav_set_selected('nothing'); + $this->create_channel_links(); - $Router = new Router($a); + $Router = new Router(); + + $this->initialise_content(); + + $Router->Dispatch(); + + $this->set_homebase(); + + // now that we've been through the module content, see if the page reported + // a permission problem and if so, a 403 response would seem to be in order. + + if(is_array($_SESSION['sysmsg']) && stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) { + header($_SERVER['SERVER_PROTOCOL'] . ' 403 ' . t('Permission denied.')); + } + + call_hooks('page_end', \App::$page['content']); + + construct_page(); + + killme(); + } + + + private function initialise_content() { + + /* initialise content region */ + + if(! x(\App::$page, 'content')) + \App::$page['content'] = ''; + + call_hooks('page_content_top', \App::$page['content']); + + } + + private function create_channel_links() { /* Initialise the Link: response header if this is a channel page. * This cannot be done inside the channel module because some protocol @@ -135,26 +168,17 @@ class WebServer { \App::$channel_links = $x['channel_links']; header('Link: ' . \App::get_channel_links()); } + } - - - /* initialise content region */ - - if(! x(\App::$page, 'content')) - \App::$page['content'] = ''; - - call_hooks('page_content_top', \App::$page['content']); - - - $Router->Dispatch($a); - + private function set_homebase() { // If you're just visiting, let javascript take you home if(x($_SESSION, 'visitor_home')) { $homebase = $_SESSION['visitor_home']; - } elseif(local_channel()) { + } + elseif(local_channel()) { $homebase = z_root() . '/channel/' . \App::$channel['channel_address']; } @@ -162,17 +186,8 @@ class WebServer { \App::$page['content'] .= '<script>var homebase = "' . $homebase . '";</script>'; } - // now that we've been through the module content, see if the page reported - // a permission problem and if so, a 403 response would seem to be in order. - - if(is_array($_SESSION['sysmsg']) && stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) { - header($_SERVER['SERVER_PROTOCOL'] . ' 403 ' . t('Permission denied.')); - } + } - call_hooks('page_end', \App::$page['content']); - construct_page(); - killme(); - } } diff --git a/Zotlabs/Widget/Forums.php b/Zotlabs/Widget/Forums.php index 0b90b9740..44d95012f 100644 --- a/Zotlabs/Widget/Forums.php +++ b/Zotlabs/Widget/Forums.php @@ -71,6 +71,8 @@ class Forums { if($r) $r1[$x]['unseen'] = $r[0]['unseen']; + } + /** * @FIXME * This SQL makes the counts correct when you get forum posts arriving from different routes/sources @@ -79,21 +81,19 @@ class Forums { * It may make more sense in that query to look for the mention in the body rather than another join, * but that makes it very inefficient. * - $r = q("select sum(item_unseen) as unseen from item left join term on oid = id where otype = %d and owner_xchan != '%s' and item.uid = %d and url = '%s' and ttype = %d $perms_sql ", - intval(TERM_OBJ_POST), - dbesc($r1[$x]['xchan_hash']), - intval(local_channel()), - dbesc($r1[$x]['xchan_url']), - intval(TERM_MENTION) - ); - if($r) - $r1[$x]['unseen'] = ((array_key_exists('unseen',$r1[$x])) ? $r1[$x]['unseen'] + $r[0]['unseen'] : $r[0]['unseen']); + * $r = q("select sum(item_unseen) as unseen from item left join term on oid = id where otype = %d and owner_xchan != '%s' and item.uid = %d and url = '%s' and ttype = %d $perms_sql ", + * intval(TERM_OBJ_POST), + * dbesc($r1[$x]['xchan_hash']), + * intval(local_channel()), + * dbesc($r1[$x]['xchan_url']), + * intval(TERM_MENTION) + * ); + * if($r) + * $r1[$x]['unseen'] = ((array_key_exists('unseen',$r1[$x])) ? $r1[$x]['unseen'] + $r[0]['unseen'] : $r[0]['unseen']); * * end @FIXME */ - } - if($r1) { $o .= '<div class="widget">'; $o .= '<h3>' . t('Forums') . '</h3><ul class="nav nav-pills flex-column">'; diff --git a/doc/member/member_guide.bb b/doc/member/member_guide.bb index 20d273f44..6286e74a3 100644 --- a/doc/member/member_guide.bb +++ b/doc/member/member_guide.bb @@ -846,6 +846,23 @@ Your files are visible on the web at the location [observer=1][baseurl]/cloud/[o WebDAV provides a way to copy files directly to or from your computer's operating system, where your cloud files appear as a virtual disk drive. This should be used to upload large files such as video and audio; as it is not limited to available memory. See [zrl=help/member/member_guide#Cloud_Desktop_Clients]Cloud Desktop Clients[/zrl] below. +[h4]CalDAV and CardDAV access on Android[/h4] + +You can sync you calendar and contacts on Android with your Hub. + +The following steps where tested for [url=https://f-droid.org/en/packages/at.bitfire.davdroid/]DAVdroid[/url] +[list] +[*] install DAVdroid +[*] add account +[*] use "URL" and "user name" to login +[list] +[*] base url is [baseurl]/cdav +[*] user name is [observer=1][observer.webname][/observer][observer=0]username[/observer] +[/list] +[/list] + +To share your calendar visit [observer.baseurl]/cdav/calendar + [h4]Permissions[/h4] diff --git a/include/api_zot.php b/include/api_zot.php index 54f905b4c..1d30a0845 100644 --- a/include/api_zot.php +++ b/include/api_zot.php @@ -6,6 +6,8 @@ api_register_func('api/export/basic','api_export_basic', true); api_register_func('api/red/channel/export/basic','api_export_basic', true); api_register_func('api/z/1.0/channel/export/basic','api_export_basic', true); + api_register_func('api/red/channel/list','api_channel_list', true); + api_register_func('api/z/1.0/channel/list','api_channel_list', true); api_register_func('api/red/channel/stream','api_channel_stream', true); api_register_func('api/z/1.0/channel/stream','api_channel_stream', true); api_register_func('api/red/files','api_attach_list', true); @@ -111,9 +113,31 @@ } } + function api_channel_list($type) { + if(api_user() === false) { + logger('api_channel_stream: no user'); + return false; + } + + $channel = channelx_by_n(api_user()); + if(! $channel) + return false; + $ret = []; + $r = q("select channel_address from channel where channel_account_id = %d", + intval($channel['channel_account_id']) + ); + + if($r) { + foreach($r as $rv) { + $ret[] = $rv['channel_address']; + } + } + + json_return_and_die($ret); + } function api_channel_stream($type) { diff --git a/include/dba/dba_pdo.php b/include/dba/dba_pdo.php index f119d8926..7b58561a7 100755 --- a/include/dba/dba_pdo.php +++ b/include/dba/dba_pdo.php @@ -15,7 +15,7 @@ class dba_pdo extends dba_driver { $dsn = $server; } else { - $dsn = $this->driver_dbtype . ':host=' . $server . (intval($port) ? '' : ';port=' . $port); + $dsn = $this->driver_dbtype . ':host=' . $server . (intval($port) ? ';port=' . $port : ''); } $dsn .= ';dbname=' . $db; @@ -154,4 +154,4 @@ class dba_pdo extends dba_driver { return 'pdo'; } -}
\ No newline at end of file +} diff --git a/include/features.php b/include/features.php index 36eb74a9d..839faff67 100644 --- a/include/features.php +++ b/include/features.php @@ -190,6 +190,16 @@ function get_features($filtered = true) { feature_level('event_tz_select',2), ], + + [ + 'premium_channel', + t('Premium Channel'), + t('Allows you to set restrictions and terms on those that connect with your channel'), + false, + get_config('feature_lock','premium_channel'), + feature_level('premium_channel',4), + ], + [ 'advanced_dirsearch', t('Advanced Directory Search'), @@ -438,16 +448,10 @@ function get_features($filtered = true) { ], ]; + $x = [ 'features' => $arr, ]; + call_hooks('get_features',$x); - $arr['general'][] = [ - 'premium_channel', - t('Premium Channel'), - t('Allows you to set restrictions and terms on those that connect with your channel'), - false, - get_config('feature_lock','premium_channel'), - feature_level('premium_channel',4), - ]; - + $arr = $x['features']; $techlevel = get_account_techlevel(); @@ -482,7 +486,5 @@ function get_features($filtered = true) { $narr = $arr; } - $x = [ 'features' => $narr, 'filtered' => $filtered, 'techlevel' => $techlevel ]; - call_hooks('get_features',$x); - return $x['features']; + return $narr; } diff --git a/view/css/widgets.css b/view/css/widgets.css index 576445dd6..a32ac045b 100644 --- a/view/css/widgets.css +++ b/view/css/widgets.css @@ -178,15 +178,24 @@ a.wikilist { max-height: 70vh; overflow: auto; } + .notifications-textinput input { font-family: FontAwesome, sans-serif; } - .notifications-textinput { padding: .75rem 0.85rem; } +.notifications-textinput-clear { + padding: .5rem; + line-height: 1; + position: absolute; + top: .75rem; + right: 1rem; + cursor: pointer; +} + .notification-content.collapsing { overflow: hidden; } diff --git a/view/js/main.js b/view/js/main.js index 0e3dcb0ec..034a520e7 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -282,22 +282,6 @@ function viewsrc(id) { $.colorbox({href: 'viewsrc/' + id, maxWidth: '80%', maxHeight: '80%' }); } -function qCommentInsert(obj, id) { - var tmpStr = $("#comment-edit-text-" + id).val(); - if(tmpStr == aStr.comment) { - tmpStr = ''; - $("#comment-edit-text-" + id).addClass("expanded"); - openMenu("comment-edit-submit-wrapper-" + id); - } - var ins = $(obj).val(); - ins = ins.replace('<','<'); - ins = ins.replace('>','>'); - ins = ins.replace('&','&'); - ins = ins.replace('"','"'); - $("#comment-edit-text-" + id).val(tmpStr + ins); - $(obj).val(''); -} - function showHideComments(id) { if( $('#collapsed-comments-' + id).is(':visible')) { $('#collapsed-comments-' + id + ' .autotime').timeago('dispose'); @@ -909,14 +893,14 @@ function notify_popup_loader(notifyType) { if($('#tt-' + notifyType + '-only').hasClass('active')) $('#nav-' + notifyType + '-menu [data-thread_top=false]').hide(); - var filter = $('#cn-' + notifyType + '-input').val(); + var filter = $('#cn-' + notifyType + '-input').val().toString().toLowerCase(); if(filter) { $('#nav-' + notifyType + '-menu .notification').each(function(i, el){ - var cn = $(el).data('contact_name').toLowerCase(); + var cn = $(el).data('contact_name').toString().toLowerCase(); if(cn.indexOf(filter) === -1) - $(this).addClass('d-none'); + $(el).addClass('d-none'); else - $(this).removeClass('d-none'); + $(el).removeClass('d-none'); }); } }); diff --git a/view/tpl/comment_item.tpl b/view/tpl/comment_item.tpl index 62530c1de..3b51971ec 100755 --- a/view/tpl/comment_item.tpl +++ b/view/tpl/comment_item.tpl @@ -19,14 +19,6 @@ </div> {{/if}} <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text" placeholder="{{$comment}}" name="body" ondragenter="linkdropper(event);" ondragleave="linkdropexit(event);" ondragover="linkdropper(event);" ondrop="linkdrop(event);" ></textarea> - {{if $qcomment}} - <select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});" > - <option value=""></option> - {{foreach $qcomment as $qc}} - <option value="{{$qc}}">{{$qc}}</option> - {{/foreach}} - </select> - {{/if}} <div id="comment-tools-{{$id}}" class="pt-2 comment-tools"> <div id="comment-edit-bb-{{$id}}" class="btn-toolbar pull-left"> <div class="btn-group mr-2"> diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl index 9489e850c..6b3f4b15b 100644 --- a/view/tpl/notifications_widget.tpl +++ b/view/tpl/notifications_widget.tpl @@ -65,16 +65,26 @@ $('#nav-{{$notification.type}}-menu [data-thread_top=false]').toggle(); $(this).toggleClass('active sticky-top'); }); - $(document).on('keyup', '#cn-{{$notification.type}}-input', function(e) { - var val = $('#cn-{{$notification.type}}-input').val().toLowerCase(); + $(document).on('click ', '#cn-{{$notification.type}}-input-clear', function(e) { + $('#cn-{{$notification.type}}-input').val(''); + $('#cn-{{$notification.type}}-only').removeClass('active sticky-top'); + $("#nav-{{$notification.type}}-menu .notification").removeClass('d-none'); + $('#cn-{{$notification.type}}-input-clear').addClass('d-none'); + }); + $(document).on('input', '#cn-{{$notification.type}}-input', function(e) { + var val = $('#cn-{{$notification.type}}-input').val().toString().toLowerCase(); - if(val) + if(val) { $('#cn-{{$notification.type}}-only').addClass('active sticky-top'); - else + $('#cn-{{$notification.type}}-input-clear').removeClass('d-none'); + } + else { $('#cn-{{$notification.type}}-only').removeClass('active sticky-top'); + $('#cn-{{$notification.type}}-input-clear').addClass('d-none'); + } $("#nav-{{$notification.type}}-menu .notification").each(function(i, el){ - var cn = $(el).data('contact_name').toLowerCase(); + var cn = $(el).data('contact_name').toString().toLowerCase(); if(cn.indexOf(val) === -1) $(this).addClass('d-none'); @@ -134,8 +144,9 @@ <div class="list-group-item cursor-pointer" id="tt-{{$notification.type}}-only"> <i class="fa fa-fw fa-filter"></i> {{$notification.filter.label}} </div> - <div class="list-group-item notifications-textinput" id="cn-{{$notification.type}}-only"> + <div class="list-group-item clearfix notifications-textinput" id="cn-{{$notification.type}}-only"> <input id="cn-{{$notification.type}}-input" type="text" class="form-control form-control-sm" placeholder=" Filter by name"> + <div id="cn-{{$notification.type}}-input-clear" class="text-muted notifications-textinput-clear d-none"><i class="fa fa-times"></i></div> </div> {{/if}} <div id="nav-{{$notification.type}}-menu" class="" rel="{{$notification.type}}"> |