From 6a2c5e07310e723d020e4b6d4123181db5c805db Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 10 Oct 2017 16:05:10 -0700 Subject: pdledit usability improvements --- Zotlabs/Module/Pdledit.php | 26 +++++++++++++++++++++++--- view/tpl/pdledit.tpl | 3 +++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Zotlabs/Module/Pdledit.php b/Zotlabs/Module/Pdledit.php index 618444480..f8af470ac 100644 --- a/Zotlabs/Module/Pdledit.php +++ b/Zotlabs/Module/Pdledit.php @@ -14,7 +14,7 @@ class Pdledit extends \Zotlabs\Web\Controller { if(! trim($_REQUEST['content'])) { del_pconfig(local_channel(),'system','mod_' . $_REQUEST['module'] . '.pdl'); - goaway(z_root() . '/pdledit/' . $_REQUEST['module']); + goaway(z_root() . '/pdledit'); } set_pconfig(local_channel(),'system','mod_' . $_REQUEST['module'] . '.pdl',escape_tags($_REQUEST['content'])); build_sync_packet(); @@ -34,19 +34,38 @@ class Pdledit extends \Zotlabs\Web\Controller { notice( t('Feature disabled.') . EOL); return; } - + + if(argc() > 2 && argv(2) === 'reset') { + del_pconfig(local_channel(),'system','mod_' . argv(1) . '.pdl'); + goaway(z_root() . '/pdledit'); + } + if(argc() > 1) $module = 'mod_' . argv(1) . '.pdl'; else { $o .= '
'; $o .= '

' . t('Edit System Page Description') . '

'; + + $edited = []; + + $r = q("select k from pconfig where uid = %d and cat = 'system' and k like '%s' ", + intval(local_channel()), + dbesc('mod_%.pdl') + ); + + if($r) { + foreach($r as $rv) { + $edited[] = substr(str_replace('.pdl','',$rv['k']),4); + } + } + $files = glob('Zotlabs/Module/*.php'); if($files) { foreach($files as $f) { $name = lcfirst(basename($f,'.php')); $x = theme_include('mod_' . $name . '.pdl'); if($x) { - $o .= '' . $name . '
'; + $o .= '' . $name . '' . ((in_array($name,$edited)) ? ' ' . t('(modified)') . ' ' . t('Reset') . '': '' ) . '
'; } } } @@ -69,6 +88,7 @@ class Pdledit extends \Zotlabs\Web\Controller { '$header' => t('Edit System Page Description'), '$mname' => t('Module Name:'), '$help' => t('Layout Help'), + '$another' => t('Edit another layout'), '$module' => argv(1), '$content' => htmlspecialchars($t,ENT_COMPAT,'UTF-8'), '$submit' => t('Submit') diff --git a/view/tpl/pdledit.tpl b/view/tpl/pdledit.tpl index cef93d324..2ea89b6c1 100644 --- a/view/tpl/pdledit.tpl +++ b/view/tpl/pdledit.tpl @@ -5,6 +5,9 @@
{{$help}} +
+
+{{$another}}

-- cgit v1.2.3 From 69394c1680cc72b5c4b43c8d321a5348ca75be35 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 10 Oct 2017 18:40:02 -0700 Subject: re-implement single delivery --- Zotlabs/Daemon/Notifier.php | 23 ++++++++++++++++++++--- include/import.php | 9 +++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index 5f8490b06..84212270f 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -66,6 +66,8 @@ require_once('include/bbcode.php'); * purge_all channel_id * expire channel_id * relay item_id (item was relayed to owner, we will deliver it as owner) + * single_activity item_id (deliver to a singleton network from the appropriate clone) + * single_mail mail_id (deliver to a singleton network from the appropriate clone) * location channel_id * request channel_id xchan_hash message_id * rating xlink_id @@ -106,7 +108,7 @@ class Notifier { $normal_mode = true; $packet_type = 'undefined'; - if($cmd === 'mail') { + if($cmd === 'mail' || $cmd === 'single_mail') { $normal_mode = false; $mail = true; $private = true; @@ -466,7 +468,7 @@ class Notifier { 'uplink' => $uplink, 'cmd' => $cmd, 'mail' => $mail, - 'single' => false, + 'single' => (($cmd === 'single_mail' || $cmd === 'single_activity') ? true : false), 'location' => $location, 'request' => $request, 'normal_mode' => $normal_mode, @@ -574,7 +576,7 @@ class Notifier { 'uplink' => $uplink, 'cmd' => $cmd, 'mail' => $mail, - 'single' => false, + 'single' => (($cmd === 'single_mail' || $cmd === 'single_activity') ? true : false), 'location' => $location, 'request' => $request, 'normal_mode' => $normal_mode, @@ -593,6 +595,21 @@ class Notifier { } + // singleton deliveries by definition 'not got zot'. + // Single deliveries are other federated networks (plugins) and we're essentially + // delivering only to those that have this site url in their abook_instance + // and only from within a sync operation. This means if you post from a clone, + // and a connection is connected to one of your other clones; assuming that hub + // is running it will receive a sync packet. On receipt of this sync packet it + // will invoke a delivery to those connections which are connected to just that + // hub instance. + + if($cmd === 'single_mail' || $cmd === 'single_activity') { + continue; + } + + // default: zot protocol + $hash = random_string(); $packet = null; $pmsg = ''; diff --git a/include/import.php b/include/import.php index 4d38c8061..702fa7e54 100644 --- a/include/import.php +++ b/include/import.php @@ -644,6 +644,12 @@ function import_items($channel, $items, $sync = false, $relocate = null) { fix_attached_file_permissions($channel,$item['author_xchan'],$item['body'],$item['allow_cid'],$item['allow_gid'],$item['deny_cid'],$item['deny_gid']); + if($sync && $item['item_wall']) { + // deliver singletons if we have any + if($item_result && $item_result['success']) { + Zotlabs\Daemon\Master::Summon( [ 'Notifier','single_activity',$item_result['item_id'] ]); + } + } } } } @@ -1017,6 +1023,9 @@ function import_mail($channel, $mails, $sync = false) { $m['aid'] = $channel['channel_account_id']; $m['uid'] = $channel['channel_id']; $mail_id = mail_store($m); + if($sync && $mail_id) { + Zotlabs\Daemon\Master::Summon(array('Notifier','single_mail',$mail_id)); + } } } } -- cgit v1.2.3 From 09b4660c7d8d15cf2419202116199a725c7c109c Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 10 Oct 2017 18:50:01 -0700 Subject: rename view/tpl/nav.tpl to navbar_default.tpl so that all navbar selection code is consistent --- boot.php | 2 +- doc/member/member_guide.bb | 2 +- include/nav.php | 4 +- view/tpl/nav.tpl | 170 -------------------------------------------- view/tpl/navbar_default.tpl | 170 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 174 insertions(+), 174 deletions(-) delete mode 100755 view/tpl/nav.tpl create mode 100755 view/tpl/navbar_default.tpl diff --git a/boot.php b/boot.php index 3feac5177..367fe7709 100755 --- a/boot.php +++ b/boot.php @@ -2090,7 +2090,7 @@ function construct_page() { $installing = false; - $navbar = get_config('system','navbar','nav'); + $navbar = get_config('system','navbar','default'); if(App::$profile_uid) { $navbar = get_pconfig(App::$profile_uid,'system','navbar',$navbar); } diff --git a/doc/member/member_guide.bb b/doc/member/member_guide.bb index 0794f24d3..4a9262741 100644 --- a/doc/member/member_guide.bb +++ b/doc/member/member_guide.bb @@ -640,7 +640,7 @@ The condensed notation isn't part of Comanche itself but is recognised by $Proje [navbar]tucson[/navbar] [/code] -Use the 'tucson' navbar template and CSS rules. By default the 'nav' navbar template will be used. +Use the 'tucson' navbar template and CSS rules. By default the 'default' navbar template will be used. [h4]Regions[/h4] diff --git a/include/nav.php b/include/nav.php index b5f713145..0d554fc84 100644 --- a/include/nav.php +++ b/include/nav.php @@ -6,7 +6,7 @@ require_once('include/security.php'); require_once('include/menu.php'); -function nav($template = 'nav') { +function nav($template = 'default') { /** * @@ -248,7 +248,7 @@ EOT; } if(! $tpl) { - $tpl = get_markup_template('nav.tpl'); + $tpl = get_markup_template('navbar_default.tpl'); } App::$page['nav'] .= replace_macros($tpl, array( diff --git a/view/tpl/nav.tpl b/view/tpl/nav.tpl deleted file mode 100755 index b6faad0c2..000000000 --- a/view/tpl/nav.tpl +++ /dev/null @@ -1,170 +0,0 @@ -{{if $nav.login && !$userinfo}} -
- - {{$nav.loginmenu.1.1}} - - {{if $nav.register}} - - {{$nav.register.1}} - - {{/if}} -
-{{/if}} -{{if $userinfo}} - - -{{/if}} - - - -{{if $nav.help.6}} -
- {{$nav.help.5}} - -
-{{/if}} diff --git a/view/tpl/navbar_default.tpl b/view/tpl/navbar_default.tpl new file mode 100755 index 000000000..b6faad0c2 --- /dev/null +++ b/view/tpl/navbar_default.tpl @@ -0,0 +1,170 @@ +{{if $nav.login && !$userinfo}} +
+ + {{$nav.loginmenu.1.1}} + + {{if $nav.register}} + + {{$nav.register.1}} + + {{/if}} +
+{{/if}} +{{if $userinfo}} + + +{{/if}} + + + +{{if $nav.help.6}} +
+ {{$nav.help.5}} + +
+{{/if}} -- cgit v1.2.3 From 769da564e296d9589522b9578f8974fcc7c385c5 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 10 Oct 2017 19:22:24 -0700 Subject: re-order the navbar preferences - 1. profile_uid, 2. local_channel, 3, site, 4 'default' --- boot.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/boot.php b/boot.php index 367fe7709..2819b8d75 100755 --- a/boot.php +++ b/boot.php @@ -2090,9 +2090,11 @@ function construct_page() { $installing = false; + $uid = ((App::$profile_uid) ? App::$profile_uid : local_channel()); + $navbar = get_config('system','navbar','default'); - if(App::$profile_uid) { - $navbar = get_pconfig(App::$profile_uid,'system','navbar',$navbar); + if($uid) { + $navbar = get_pconfig($uid,'system','navbar',$navbar); } if($comanche && App::$layout['navbar']) { -- cgit v1.2.3 From 1a7ccc462b8aeea7704562b8d14d31e3bcb41622 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 10 Oct 2017 19:45:11 -0700 Subject: on failed auth due to unverified email, tell the person why and remind them to check their email. --- include/auth.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/auth.php b/include/auth.php index c7be69583..78be32bf4 100644 --- a/include/auth.php +++ b/include/auth.php @@ -83,7 +83,7 @@ function account_verify_password($login, $pass) { if(($email_verify) && ($register_policy == REGISTER_OPEN) && ($account['account_flags'] & ACCOUNT_UNVERIFIED)) { logger('email verification required for ' . $login); - return null; + return ( [ 'reason' => 'unvalidated' ] ); } if(($account['account_flags'] == ACCOUNT_OK) @@ -259,7 +259,10 @@ else { } else { $verify = account_verify_password($_POST['username'], $_POST['password']); - if($verify) { + if($verify && array_key_exists('reason',$verify) && $verify['reason'] === 'unvalidated') { + notice( t('Email validation is incomplete. Please check your email.')); + } + elseif($verify) { $atoken = $verify['xchan']; $channel = $verify['channel']; $account = App::$account = $verify['account']; -- cgit v1.2.3 From ff8ee6fb2250d2188962f4b27de91b89465cc3d5 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 10 Oct 2017 22:02:22 -0700 Subject: for federated forums we need to keep track of what protocols are available to red/hubzilla channels to determine which posts need to be mangled for transport to individual networks - based on what networks the author can communicate with. We probably need this for all xchans and hublocs but at some point it becomes increasingly difficult to scrape this information and map out a compatibility matrix. It's also doubtful anybody will use this system because we basically have to forge comments between network sites involving different protocols and this is going to look like crap to anybody that isn't on red/Hubzilla. Eventually they have to fix their protocols for this to work correctly, but nobody seems to believe me that their networks are basically anti-federation, so we need something like this to highlight their walled garden specifications and the resulting federation problems in a form they can't really argue with. --- include/zot.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/zot.php b/include/zot.php index af7fbf8fd..b6df6bca8 100644 --- a/include/zot.php +++ b/include/zot.php @@ -718,6 +718,16 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED, $ud_arr = null) { if(intval($r[0]['xchan_pubforum']) != intval($arr['public_forum'])) $pubforum_changed = 1; + if($arr['protocols']) { + $protocols = implode(',',$arr['protocols']); + if($protocols !== 'zot') { + set_xconfig($xchan_hash,'system','protocols',$protocols); + } + else { + del_xconfig($xchan_hash,'system','protocols'); + } + } + if(($r[0]['xchan_name_date'] != $arr['name_updated']) || ($r[0]['xchan_connurl'] != $arr['connections_url']) || ($r[0]['xchan_addr'] != $arr['address']) @@ -4035,6 +4045,11 @@ function zotinfo($arr) { $id = $e['channel_id']; + $x = [ 'channel_id' => $id, 'protocols' => 'zot' ]; + call_hooks('channel_protocols',$x); + $protocols = $x['protocols']; + + $sys_channel = (intval($e['channel_system']) ? true : false); $special_channel = (($e['channel_pageflags'] & PAGE_PREMIUM) ? true : false); $adult_channel = (($e['channel_pageflags'] & PAGE_ADULT) ? true : false); @@ -4135,6 +4150,7 @@ function zotinfo($arr) { $ret['target'] = $ztarget; $ret['target_sig'] = $zsig; $ret['searchable'] = $searchable; + $ret['protocols'] = $protocols; $ret['adult_content'] = $adult_channel; $ret['public_forum'] = $public_forum; if($deleted) -- cgit v1.2.3 From 0c5918f29096f173f3dcacd572916611d9ca7558 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 11 Oct 2017 01:21:00 -0700 Subject: bring back some nav stuff (notifications) for alternate navbars; still some things missing as the notification dropdowns aren't fully functional. --- include/nav.php | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/include/nav.php b/include/nav.php index 0d554fc84..6fd7d527b 100644 --- a/include/nav.php +++ b/include/nav.php @@ -92,6 +92,46 @@ EOT; } if(local_channel()) { + + + + $nav['network'] = array('network', t('Activity'), "", t('Network Activity'),'network_nav_btn'); + $nav['network']['all'] = [ 'network', t('View your network activity'), '','' ]; + $nav['network']['mark'] = array('', t('Mark all activity notifications seen'), '',''); + + $nav['home'] = array('channel/' . $channel['channel_address'], t('Channel Home'), "", t('Channel home'),'home_nav_btn'); + $nav['home']['all'] = [ 'channel/' . $channel['channel_address'], t('View your channel home'), '' , '' ]; + $nav['home']['mark'] = array('', t('Mark all channel notifications seen'), '',''); + + + $nav['intros'] = array('connections/ifpending', t('Connections'), "", t('Connections'),'connections_nav_btn'); + if(is_site_admin()) + $nav['registrations'] = array('admin/accounts', t('Registrations'), "", t('Registrations'),'registrations_nav_btn'); + + + $nav['notifications'] = array('notifications/system', t('Notices'), "", t('Notifications'),'notifications_nav_btn'); + $nav['notifications']['all']=array('notifications/system', t('View all notifications'), "", ""); + $nav['notifications']['mark'] = array('', t('Mark all system notifications seen'), '',''); + + $nav['messages'] = array('mail/combined', t('Mail'), "", t('Private mail'),'mail_nav_btn'); + $nav['messages']['all']=array('mail/combined', t('View your private messages'), "", ""); + $nav['messages']['mark'] = array('', t('Mark all private messages seen'), '',''); + $nav['messages']['inbox'] = array('mail/inbox', t('Inbox'), "", t('Inbox')); + $nav['messages']['outbox']= array('mail/outbox', t('Outbox'), "", t('Outbox')); + $nav['messages']['new'] = array('mail/new', t('New Message'), "", t('New Message')); + + + $nav['all_events'] = array('events', t('Events'), "", t('Event Calendar'),'events_nav_btn'); + $nav['all_events']['all']=array('events', t('View events'), "", ""); + $nav['all_events']['mark'] = array('', t('Mark all events seen'), '',''); + + if(! $_SESSION['delegate']) { + $nav['manage'] = array('manage', t('Channel Manager'), "", t('Manage Your Channels'),'manage_nav_btn'); + } + + $nav['settings'] = array('settings', t('Settings'),"", t('Account/Channel Settings'),'settings_nav_btn'); + + if($chans && count($chans) > 1 && feature_enabled(local_channel(),'nav_channel_select')) $nav['channels'] = $chans; -- cgit v1.2.3 From ba55400f14c7930786785db13a18a6333c20ee7d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 11 Oct 2017 11:49:03 +0200 Subject: bring nav pinned apps to navbar_default --- view/tpl/app_nav.tpl | 2 +- view/tpl/navbar_default.tpl | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/view/tpl/app_nav.tpl b/view/tpl/app_nav.tpl index 1ee5adb70..046cd7237 100644 --- a/view/tpl/app_nav.tpl +++ b/view/tpl/app_nav.tpl @@ -1 +1 @@ -{{if $icon}}{{else}}{{/if}} +{{if $icon}}{{else}}{{/if}} diff --git a/view/tpl/navbar_default.tpl b/view/tpl/navbar_default.tpl index b6faad0c2..9495ea7a4 100755 --- a/view/tpl/navbar_default.tpl +++ b/view/tpl/navbar_default.tpl @@ -107,6 +107,13 @@
{{/if}} + {{if $navbar_apps}} + {{foreach $navbar_apps as $navbar_app}} +
  • + {{$navbar_app}} +
  • + {{/foreach}} + {{/if}}