From 96fdb88690fcb572b5bc4948a7df71b3c257a97d Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 23 Feb 2017 15:15:19 -0800 Subject: nativewiki: only apply markdown filter to markdown input --- Zotlabs/Lib/NativeWikiPage.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php index cdb2a5134..af0286997 100644 --- a/Zotlabs/Lib/NativeWikiPage.php +++ b/Zotlabs/Lib/NativeWikiPage.php @@ -333,18 +333,26 @@ class NativeWikiPage { static public function save_page($arr) { - $pageUrlName = ((array_key_exists('pageUrlName',$arr)) ? $arr['pageUrlName'] : ''); - $content = ((array_key_exists('content',$arr)) ? purify_html(Zlib\NativeWikiPage::prepare_content($arr['content'])) : ''); - $resource_id = ((array_key_exists('resource_id',$arr)) ? $arr['resource_id'] : ''); + $pageUrlName = ((array_key_exists('pageUrlName',$arr)) ? $arr['pageUrlName'] : ''); + $content = ((array_key_exists('content',$arr)) ? $arr['content'] : ''); + $resource_id = ((array_key_exists('resource_id',$arr)) ? $arr['resource_id'] : ''); $observer_hash = ((array_key_exists('observer_hash',$arr)) ? $arr['observer_hash'] : ''); $channel_id = ((array_key_exists('channel_id',$arr)) ? $arr['channel_id'] : 0); - $revision = ((array_key_exists('revision',$arr)) ? $arr['revision'] : 0); + $revision = ((array_key_exists('revision',$arr)) ? $arr['revision'] : 0); $w = Zlib\NativeWiki::get_wiki($channel_id, $observer_hash, $resource_id); if (!$w['wiki']) { return array('message' => t('Error reading wiki'), 'success' => false); } + + $mimetype = $w['mimeType']; + if($mimetype === 'text/markdown') { + $content = purify_html(Zlib\NativeWikiPage::prepare_content($content)); + } + else { + $content = escape_tags($content); + } // fetch the most recently saved revision. -- cgit v1.2.3 From b1ff5367e7e853d7e0e24c91aecc3a8f80d0ba87 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 23 Feb 2017 19:07:01 -0800 Subject: more work on profile vcards - still a lot of work to go --- Zotlabs/Module/Profiles.php | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Profiles.php b/Zotlabs/Module/Profiles.php index 32e888f14..da8b16b00 100644 --- a/Zotlabs/Module/Profiles.php +++ b/Zotlabs/Module/Profiles.php @@ -330,13 +330,7 @@ class Profiles extends \Zotlabs\Web\Controller { 'photo' => $channel['xchan_photo_l'], 'adr' => [], 'adr_type' => [ $default_vcard_cat ], - 'tel' => [], - 'tel_type' => [ $default_vcard_cat ], - 'email' => [], - 'email_type' => [ $default_vcard_cat ], - 'impp' => [], - 'impp_type' => [ $default_vcard_cat ], - 'url' => [], + 'url' => [ $homepage ], 'url_type' => [ $default_vcard_cat ] ]; @@ -350,9 +344,12 @@ class Profiles extends \Zotlabs\Web\Controller { 6 => $country_name ]; - $profile_vcard = update_vcard($defcard,$orig_vcard); + $orig_vcard = \Sabre\VObject\Reader::read($profile_vcard); + + $profile_vcard = update_vcard($_REQUEST,$orig_vcard); + require_once('include/text.php'); linkify_tags($a, $likes, local_channel()); @@ -700,6 +697,10 @@ class Profiles extends \Zotlabs\Web\Controller { } //logger('extra_fields: ' . print_r($extra_fields,true)); + + $vc = $r[0]['profile_vcard']; + $vctmp = (($vc) ? \Sabre\VObject\Reader::read($vc) : null); + $vcard = (($vctmp) ? get_vcard_array($vctmp,$contact['abook_id']) : [] ); $f = get_config('system','birthday_input_format'); if(! $f) @@ -717,6 +718,7 @@ class Profiles extends \Zotlabs\Web\Controller { . get_form_security_token("profile_drop"), '$fields' => $fields, + '$vcard' => $vcard, '$guid' => $r[0]['profile_guid'], '$banner' => t('Edit Profile Details'), '$submit' => t('Submit'), @@ -776,11 +778,27 @@ class Profiles extends \Zotlabs\Web\Controller { '$film' => array('film', t('Film/Dance/Culture/Entertainment'), $r[0]['film']), '$interest' => array('interest', t('Hobbies/Interests'), $r[0]['interest']), '$romance' => array('romance',t('Love/Romance'), $r[0]['romance']), - '$work' => array('work', t('Work/Employment'), $r[0]['employment']), + '$employ' => array('work', t('Work/Employment'), $r[0]['employment']), '$education' => array('education', t('School/Education'), $r[0]['education']), '$contact' => array('contact', t('Contact information and social networks'), $r[0]['contact']), '$channels' => array('channels', t('My other channels'), $r[0]['channels']), '$extra_fields' => $extra_fields, + '$tel_label' => t('Phone'), + '$email_label' => t('Email'), + '$impp_label' => t('Instant messenger'), + '$url_label' => t('Website'), + '$adr_label' => t('Address'), + '$note_label' => t('Note'), + '$mobile' => t('Mobile'), + '$home' => t('Home'), + '$work' => t('Work'), + '$other' => t('Other'), + '$add_card' => t('Add Contact'), + '$add_field' => t('Add Field'), + '$create' => t('Create'), + '$update' => t('Update'), + '$delete' => t('Delete'), + '$cancel' => t('Cancel'), )); $arr = array('profile' => $r[0], 'entry' => $o); -- cgit v1.2.3 From 732dfa63c783fe2e965d1051e0dea587b17aafa6 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 23 Feb 2017 20:27:12 -0800 Subject: deleting profile vcard entries was pretty well borked --- Zotlabs/Module/Profiles.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Profiles.php b/Zotlabs/Module/Profiles.php index da8b16b00..d6c9d6570 100644 --- a/Zotlabs/Module/Profiles.php +++ b/Zotlabs/Module/Profiles.php @@ -317,8 +317,10 @@ class Profiles extends \Zotlabs\Web\Controller { $hide_friends = ((intval($_POST['hide_friends'])) ? 1: 0); +// start fresh and create a new vcard. TODO: preserve the original guid or whatever else needs saving +// $orig_vcard = (($orig[0]['profile_vcard']) ? \Sabre\VObject\Reader::read($orig[0]['profile_vcard']) : null); - $orig_vcard = (($orig[0]['profile_vcard']) ? \Sabre\VObject\Reader::read($orig[0]['profile_vcard']) : null); + $orig_vcard = null; $channel = \App::get_channel(); @@ -700,7 +702,7 @@ class Profiles extends \Zotlabs\Web\Controller { $vc = $r[0]['profile_vcard']; $vctmp = (($vc) ? \Sabre\VObject\Reader::read($vc) : null); - $vcard = (($vctmp) ? get_vcard_array($vctmp,$contact['abook_id']) : [] ); + $vcard = (($vctmp) ? get_vcard_array($vctmp,$r[0]['id']) : [] ); $f = get_config('system','birthday_input_format'); if(! $f) -- cgit v1.2.3 From cf11a89457d6953144efd71d2ca8f4bda88cfaf7 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 24 Feb 2017 10:07:14 +0100 Subject: use chanlink_url() in directory since the xchan might not yet be available on our server --- Zotlabs/Module/Directory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php index 583154526..59ae88857 100644 --- a/Zotlabs/Module/Directory.php +++ b/Zotlabs/Module/Directory.php @@ -206,7 +206,7 @@ class Directory extends \Zotlabs\Web\Controller { foreach($j['results'] as $rr) { - $profile_link = chanlink_hash($rr['hash']); + $profile_link = chanlink_url($rr['url']); $pdesc = (($rr['description']) ? $rr['description'] . '
' : ''); $connect_link = ((local_channel()) ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : ''); -- cgit v1.2.3 From 8d0d2015d76700a3defac8d767ce8a1c529d585b Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 24 Feb 2017 13:53:49 -0800 Subject: We've passed the deadline for allowing unsigned zot finger tokens. It is now a protocol requirement. --- Zotlabs/Zot/Finger.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Zot/Finger.php b/Zotlabs/Zot/Finger.php index 7e0f5fb7c..9871b5bbd 100644 --- a/Zotlabs/Zot/Finger.php +++ b/Zotlabs/Zot/Finger.php @@ -123,9 +123,7 @@ class Finger { } else { logger('No signed token from ' . $url . $rhs, LOGGER_NORMAL, LOG_WARNING); - // after 2017-01-01 this will be a hard error unless you over-ride it. - if((time() > 1483228800) && (! get_config('system', 'allow_unsigned_zotfinger'))) - return $ret; + return $ret; } } -- cgit v1.2.3 From 232862ae08661ecca4d0688001904648b7894a8a Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 25 Feb 2017 13:54:39 -0800 Subject: escape tags on viewsrc output in case it is not text/bbcode. --- Zotlabs/Module/Viewsrc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Viewsrc.php b/Zotlabs/Module/Viewsrc.php index fa755a3ec..cb305efc6 100644 --- a/Zotlabs/Module/Viewsrc.php +++ b/Zotlabs/Module/Viewsrc.php @@ -36,7 +36,9 @@ class Viewsrc extends \Zotlabs\Web\Controller { if($r) { if(intval($r[0]['item_obscured'])) $r[0]['body'] = crypto_unencapsulate(json_decode($r[0]['body'],true),get_config('system','prvkey')); - $o = (($json) ? json_encode($r[0]['body']) : str_replace("\n",'
',$r[0]['body'])); + + $content = escape_tags($r[0]['body']); + $o = (($json) ? json_encode($content) : str_replace("\n",'
',$content)); } } -- cgit v1.2.3 From 92615247ac46e708de46651f21a4a179c38068c4 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 25 Feb 2017 15:04:17 -0800 Subject: send sync packet on profile photo permissions change --- Zotlabs/Module/Profile_photo.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index 29a239f4d..438580917 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -183,6 +183,10 @@ class Profile_photo extends \Zotlabs\Web\Controller { photo_profile_setperms(local_channel(),$base_image['resource_id'],$_REQUEST['profile']); + $sync = attach_export_data($channel,$base_image['resource_id']); + if($sync) + build_sync_packet($channel['channel_id'],array('file' => array($sync))); + // Similarly, tell the nav bar to bypass the cache and update the avater image. $_SESSION['reload_avatar'] = true; @@ -341,6 +345,11 @@ class Profile_photo extends \Zotlabs\Web\Controller { photo_profile_setperms(local_channel(),$resource_id,$_REQUEST['profile']); + $sync = attach_export_data($channel,$resource_id); + if($sync) + build_sync_packet($channel['channel_id'],array('file' => array($sync))); + + \Zotlabs\Daemon\Master::Summon(array('Directory',local_channel())); goaway(z_root() . '/profiles'); } -- cgit v1.2.3 From 8783ccfd727dc4834c1f3c9460f851350fc912f4 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 25 Feb 2017 16:22:09 -0800 Subject: move admin permission decision out of the router - it is already provided in the module and the higher level check is causing some oembed redirect issues. --- Zotlabs/Web/Router.php | 6 ------ 1 file changed, 6 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Web/Router.php b/Zotlabs/Web/Router.php index ba2e78b25..948f073d6 100644 --- a/Zotlabs/Web/Router.php +++ b/Zotlabs/Web/Router.php @@ -62,12 +62,6 @@ class Router { } } - if((strpos($module,'admin') === 0) && (! is_site_admin())) { - \App::$module_loaded = false; - notice( t('Permission denied.') . EOL); - goaway(z_root()); - } - /* * If the site has a custom module to over-ride the standard module, use it. * Otherwise, look for the standard program module -- cgit v1.2.3 From 4f07abe65586d66b0000e9b877ce467d71178aa2 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 26 Feb 2017 21:01:20 +0100 Subject: add a minversion to the theme and fallback to default if requirement is not met. mark incompatible themes in the theme selector --- Zotlabs/Module/Admin/Site.php | 9 ++++++++- Zotlabs/Module/Admin/Themes.php | 2 +- Zotlabs/Module/Settings/Display.php | 12 +++++++++--- Zotlabs/Render/Theme.php | 7 ++++++- 4 files changed, 24 insertions(+), 6 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index 829ca71e4..3bb384ec5 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -163,6 +163,13 @@ class Site { foreach($files as $file) { $vars = ''; $f = basename($file); + + $min_version = ((file_exists('view/theme/' . $f . '/.MINVERSION')) ? file_get_contents('view/theme/' . $f . '/.MINVERSION') : 0); + if((version_compare($min_version, STD_VERSION, '>=')) || ($min_version == 0)) { + $theme_choices[$f] = $theme_choices_mobile[$f] = sprintf(t('%s - (Incompatible)'), $f); + continue; + } + if (file_exists($file . '/library')) continue; if (file_exists($file . '/mobile')) @@ -310,4 +317,4 @@ class Site { )); } -} \ No newline at end of file +} diff --git a/Zotlabs/Module/Admin/Themes.php b/Zotlabs/Module/Admin/Themes.php index 63a9a1670..fc908ec8b 100644 --- a/Zotlabs/Module/Admin/Themes.php +++ b/Zotlabs/Module/Admin/Themes.php @@ -230,4 +230,4 @@ class Themes { -} \ No newline at end of file +} diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index 67cecf1f5..d5be07a81 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -130,12 +130,19 @@ class Display { if($allowed_themes) { foreach($allowed_themes as $th) { $f = $th; + + $min_version = ((file_exists('view/theme/' . $th . '/.MINVERSION')) ? file_get_contents('view/theme/' . $th . '/.MINVERSION') : 0); + if((version_compare($min_version, STD_VERSION, '>=')) || ($min_version == 0)) { + $mobile_themes[$f] = $themes[$f] = sprintf(t('%s - (Incompatible)'), $f); + continue; + } + $is_experimental = file_exists('view/theme/' . $th . '/experimental'); $unsupported = file_exists('view/theme/' . $th . '/unsupported'); $is_mobile = file_exists('view/theme/' . $th . '/mobile'); $is_library = file_exists('view/theme/'. $th . '/library'); - $mobile_themes["---"] = t("No special theme for mobile devices"); - + $mobile_themes['---'] = t("No special theme for mobile devices"); + if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){ $theme_name = (($is_experimental) ? sprintf(t('%s - (Experimental)'), $f) : $f); if (! $is_library) { @@ -147,7 +154,6 @@ class Display { } } } - } } diff --git a/Zotlabs/Render/Theme.php b/Zotlabs/Render/Theme.php index dadb18051..53bcfe664 100644 --- a/Zotlabs/Render/Theme.php +++ b/Zotlabs/Render/Theme.php @@ -69,8 +69,13 @@ class Theme { if(array_key_exists('theme_preview',$_GET)) $chosen_theme = $_GET['theme_preview']; - // Allow theme selection of the form 'theme_name:schema_name' + // Check if $chosen_theme is compatible with core. If not fall back to default + $min_version = ((file_exists('view/theme/' . $chosen_theme . '/.MINVERSION')) ? file_get_contents('view/theme/' . $chosen_theme . '/.MINVERSION') : 0); + if((version_compare($min_version, STD_VERSION, '>=')) || ($min_version == 0)) { + $chosen_theme = ''; + } + // Allow theme selection of the form 'theme_name:schema_name' $themepair = explode(':', $chosen_theme); if($chosen_theme && (file_exists('view/theme/' . $themepair[0] . '/css/style.css') || file_exists('view/theme/' . $themepair[0] . '/php/style.php'))) { -- cgit v1.2.3 From 0f208fb36bca5e3395d34ce3553d98bab389ddd3 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 27 Feb 2017 10:13:08 +0100 Subject: set minversion and maxversion for themes in view/theme/themename/php/theme.php instead of separate file. --- Zotlabs/Module/Admin/Site.php | 5 +++-- Zotlabs/Module/Settings/Display.php | 5 +++-- Zotlabs/Render/Theme.php | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index 3bb384ec5..b71e63030 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -164,8 +164,9 @@ class Site { $vars = ''; $f = basename($file); - $min_version = ((file_exists('view/theme/' . $f . '/.MINVERSION')) ? file_get_contents('view/theme/' . $f . '/.MINVERSION') : 0); - if((version_compare($min_version, STD_VERSION, '>=')) || ($min_version == 0)) { + $info = get_theme_info($f); + $compatible = check_plugin_versions($info); + if(!$compatible) { $theme_choices[$f] = $theme_choices_mobile[$f] = sprintf(t('%s - (Incompatible)'), $f); continue; } diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index d5be07a81..ee404daba 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -131,8 +131,9 @@ class Display { foreach($allowed_themes as $th) { $f = $th; - $min_version = ((file_exists('view/theme/' . $th . '/.MINVERSION')) ? file_get_contents('view/theme/' . $th . '/.MINVERSION') : 0); - if((version_compare($min_version, STD_VERSION, '>=')) || ($min_version == 0)) { + $info = get_theme_info($th); + $compatible = check_plugin_versions($info); + if(!$compatible) { $mobile_themes[$f] = $themes[$f] = sprintf(t('%s - (Incompatible)'), $f); continue; } diff --git a/Zotlabs/Render/Theme.php b/Zotlabs/Render/Theme.php index 53bcfe664..7464a0db2 100644 --- a/Zotlabs/Render/Theme.php +++ b/Zotlabs/Render/Theme.php @@ -70,8 +70,9 @@ class Theme { $chosen_theme = $_GET['theme_preview']; // Check if $chosen_theme is compatible with core. If not fall back to default - $min_version = ((file_exists('view/theme/' . $chosen_theme . '/.MINVERSION')) ? file_get_contents('view/theme/' . $chosen_theme . '/.MINVERSION') : 0); - if((version_compare($min_version, STD_VERSION, '>=')) || ($min_version == 0)) { + $info = get_theme_info($chosen_theme); + $compatible = check_plugin_versions($info); + if(!$compatible) { $chosen_theme = ''; } -- cgit v1.2.3 From f93431b43ef1e8211b6f00361d9399bf0383451b Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 27 Feb 2017 10:44:50 +0100 Subject: do not mess up schemas --- Zotlabs/Render/Theme.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Render/Theme.php b/Zotlabs/Render/Theme.php index 7464a0db2..71eef50c3 100644 --- a/Zotlabs/Render/Theme.php +++ b/Zotlabs/Render/Theme.php @@ -69,16 +69,18 @@ class Theme { if(array_key_exists('theme_preview',$_GET)) $chosen_theme = $_GET['theme_preview']; + + + // Allow theme selection of the form 'theme_name:schema_name' + $themepair = explode(':', $chosen_theme); + // Check if $chosen_theme is compatible with core. If not fall back to default - $info = get_theme_info($chosen_theme); + $info = get_theme_info($themepair[0]); $compatible = check_plugin_versions($info); if(!$compatible) { $chosen_theme = ''; } - // Allow theme selection of the form 'theme_name:schema_name' - $themepair = explode(':', $chosen_theme); - if($chosen_theme && (file_exists('view/theme/' . $themepair[0] . '/css/style.css') || file_exists('view/theme/' . $themepair[0] . '/php/style.php'))) { return($themepair); } -- cgit v1.2.3 From 7f423016f0c67302a9155d58f2cf6148e5399a87 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 27 Feb 2017 11:11:53 +0100 Subject: whitespace --- Zotlabs/Render/Theme.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Render/Theme.php b/Zotlabs/Render/Theme.php index 71eef50c3..3a0116abe 100644 --- a/Zotlabs/Render/Theme.php +++ b/Zotlabs/Render/Theme.php @@ -69,8 +69,6 @@ class Theme { if(array_key_exists('theme_preview',$_GET)) $chosen_theme = $_GET['theme_preview']; - - // Allow theme selection of the form 'theme_name:schema_name' $themepair = explode(':', $chosen_theme); -- cgit v1.2.3 From a6d13f290b235b5c4a511079b622866573e8d2e3 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 27 Feb 2017 13:52:08 +0100 Subject: fix js issue in markdown mimetype wikis if content contains quotes --- Zotlabs/Module/Wiki.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 32b484eea..15806ffc3 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -234,10 +234,8 @@ class Wiki extends \Zotlabs\Web\Controller { $mimeType = $p['mimeType']; - $rawContent = (($p['mimeType'] == 'text/bbcode') - ? htmlspecialchars_decode(json_decode($p['content']),ENT_COMPAT) - : htmlspecialchars_decode($p['content'],ENT_COMPAT) - ); + $rawContent = htmlspecialchars_decode(json_decode($p['content']),ENT_COMPAT); + $content = ($p['content'] !== '' ? $rawContent : '"# New page\n"'); // Render the Markdown-formatted page content in HTML if($mimeType == 'text/bbcode') { @@ -245,7 +243,7 @@ class Wiki extends \Zotlabs\Web\Controller { } else { require_once('library/markdown.php'); - $html = Zlib\NativeWikiPage::generate_toc(zidify_text(purify_html(Markdown(Zlib\NativeWikiPage::bbcode(json_decode($content)))))); + $html = Zlib\NativeWikiPage::generate_toc(zidify_text(purify_html(Markdown(Zlib\NativeWikiPage::bbcode($content))))); $renderedContent = Zlib\NativeWikiPage::convert_links($html, argv(0) . '/' . argv(1) . '/' . $wikiUrlName); } $showPageControls = $wiki_editor; -- cgit v1.2.3 From 503c368f9ec08a70e4dbacd7b729568da6e4ea92 Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Sat, 25 Feb 2017 19:12:41 +0100 Subject: :arrow_up: :hammer: Upgrade PHP Markdown library. The current version throws deprecated warning with PHP7.1 and PHPUnit. Upgrade the Markdown library to the current PHP Markdown Lib 1.7.0. Used composer to manage this library. --- Zotlabs/Module/Admin/Plugins.php | 82 +++++++++++++++++++------------------ Zotlabs/Module/Admin/Themes.php | 87 +++++++++++++++++++--------------------- Zotlabs/Module/Wiki.php | 4 +- 3 files changed, 86 insertions(+), 87 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Admin/Plugins.php b/Zotlabs/Module/Admin/Plugins.php index 527e96496..feb29e9d6 100644 --- a/Zotlabs/Module/Admin/Plugins.php +++ b/Zotlabs/Module/Admin/Plugins.php @@ -3,10 +3,14 @@ namespace Zotlabs\Module\Admin; use \Zotlabs\Storage\GitRepo as GitRepo; +use \Michelf\MarkdownExtra; class Plugins { - + /** + * @brief + * + */ function post() { if(argc() > 2 && is_file("addon/" . argv(2) . "/" . argv(2) . ".php")) { @@ -15,16 +19,15 @@ class Plugins { $func = argv(2) . '_plugin_admin_post'; $func($a); } - - goaway(z_root() . '/admin/plugins/' . argv(2) ); + goaway(z_root() . '/admin/plugins/' . argv(2) ); } elseif(argc() > 2) { switch(argv(2)) { case 'updaterepo': if (array_key_exists('repoName', $_REQUEST)) { $repoName = $_REQUEST['repoName']; - } + } else { json_return_and_die(array('message' => 'No repo name provided.', 'success' => false)); } @@ -101,16 +104,15 @@ class Plugins { logger('Repo directory not writable to web server: ' . $repoDir); json_return_and_die(array('message' => 'Repo directory not writable to web server.', 'success' => false)); } - // TODO: remove directory and unlink /addon/files + /// @TODO remove directory and unlink /addon/files if (rrmdir($repoDir)) { json_return_and_die(array('message' => 'Repo deleted.', 'success' => true)); } else { json_return_and_die(array('message' => 'Error deleting addon repo.', 'success' => false)); } case 'installrepo': - require_once('library/markdown.php'); if (array_key_exists('repoURL', $_REQUEST)) { - require_once('library/PHPGit.autoload.php'); // Load PHPGit dependencies + require_once('library/PHPGit.autoload.php'); // Load PHPGit dependencies $repoURL = $_REQUEST['repoURL']; $extendDir = 'store/[data]/git/sys/extend'; $addonDir = $extendDir . '/addon'; @@ -170,9 +172,8 @@ class Plugins { json_return_and_die(array('repo' => $repo, 'message' => '', 'success' => true)); } case 'addrepo': - require_once('library/markdown.php'); if (array_key_exists('repoURL', $_REQUEST)) { - require_once('library/PHPGit.autoload.php'); // Load PHPGit dependencies + require_once('library/PHPGit.autoload.php'); // Load PHPGit dependencies $repoURL = $_REQUEST['repoURL']; $extendDir = 'store/[data]/git/sys/extend'; $addonDir = $extendDir . '/addon'; @@ -225,7 +226,7 @@ class Plugins { $repo['readme'] = $repo['manifest'] = null; foreach ($git->git->tree('master') as $object) { if ($object['type'] == 'blob' && (strtolower($object['file']) === 'readme.md' || strtolower($object['file']) === 'readme')) { - $repo['readme'] = Markdown($git->git->cat->blob($object['hash'])); + $repo['readme'] = MarkdownExtra::defaultTransform($git->git->cat->blob($object['hash'])); } else if ($object['type'] == 'blob' && strtolower($object['file']) === 'manifest.json') { $repo['manifest'] = $git->git->cat->blob($object['hash']); } @@ -241,7 +242,11 @@ class Plugins { } } - + /** + * @brief Plugins admin page. + * + * @return string with parsed HTML + */ function get() { /* @@ -254,13 +259,13 @@ class Plugins { notice( t("Item not found.") ); return ''; } - + $enabled = in_array($plugin,\App::$plugins); $info = get_plugin_info($plugin); $x = check_plugin_versions($info); - + // disable plugins which are installed but incompatible versions - + if($enabled && ! $x) { $enabled = false; $idz = array_search($plugin, \App::$plugins); @@ -271,7 +276,7 @@ class Plugins { } } $info['disabled'] = 1-intval($x); - + if (x($_GET,"a") && $_GET['a']=="t"){ check_form_security_token_redirectOnErr('/admin/plugins', 'admin_plugins', 't'); $pinstalled = false; @@ -297,9 +302,9 @@ class Plugins { } goaway(z_root() . '/admin/plugins' ); } + // display plugin details - require_once('library/markdown.php'); - + if (in_array($plugin, \App::$plugins)){ $status = 'on'; $action = t('Disable'); @@ -307,21 +312,21 @@ class Plugins { $status = 'off'; $action = t('Enable'); } - + $readme = null; if (is_file("addon/$plugin/README.md")){ $readme = file_get_contents("addon/$plugin/README.md"); - $readme = Markdown($readme); + $readme = MarkdownExtra::defaultTransform($readme); } else if (is_file("addon/$plugin/README")){ $readme = "
". file_get_contents("addon/$plugin/README") ."
"; } - + $admin_form = ''; - + $r = q("select * from addon where plugin_admin = 1 and aname = '%s' limit 1", dbesc($plugin) ); - + if($r) { @require_once("addon/$plugin/$plugin.php"); if(function_exists($plugin.'_plugin_admin')) { @@ -329,8 +334,8 @@ class Plugins { $func($a, $admin_form); } } - - + + $t = get_markup_template('admin_plugins_details.tpl'); return replace_macros($t, array( '$title' => t('Administration'), @@ -338,7 +343,7 @@ class Plugins { '$toggle' => t('Toggle'), '$settings' => t('Settings'), '$baseurl' => z_root(), - + '$plugin' => $plugin, '$status' => $status, '$action' => $action, @@ -351,17 +356,17 @@ class Plugins { '$str_serverroles' => t('Compatible Server Roles: '), '$str_requires' => t('Requires: '), '$disabled' => t('Disabled - version incompatibility'), - + '$admin_form' => $admin_form, '$function' => 'plugins', '$screenshot' => '', '$readme' => $readme, - + '$form_security_token' => get_form_security_token('admin_plugins'), )); } - - + + /* * List plugins */ @@ -374,9 +379,9 @@ class Plugins { $info = get_plugin_info($id); $enabled = in_array($id,\App::$plugins); $x = check_plugin_versions($info); - + // disable plugins which are installed but incompatible versions - + if($enabled && ! $x) { $enabled = false; $idz = array_search($id, \App::$plugins); @@ -387,19 +392,19 @@ class Plugins { } } $info['disabled'] = 1-intval($x); - + $plugins[] = array( $id, (($enabled)?"on":"off") , $info); } } } - + usort($plugins,'self::plugin_sort'); $allowManageRepos = false; if(is_writable('extend/addon') && is_writable('store/[data]')) { $allowManageRepos = true; - } - + } + $admin_plugins_add_repo_form= replace_macros( get_markup_template('admin_plugins_addrepo.tpl'), array( '$post' => 'admin/plugins/addrepo', @@ -418,14 +423,14 @@ class Plugins { '$cancel' => t('Cancel') ) ); - + $reponames = $this->listAddonRepos(); $addonrepos = []; foreach($reponames as $repo) { $addonrepos[] = array('name' => $repo, 'description' => ''); - // TODO: Parse repo info to provide more information about repos + /// @TODO Parse repo info to provide more information about repos } - + $t = get_markup_template('admin_plugins.tpl'); return replace_macros($t, array( '$title' => t('Administration'), @@ -471,5 +476,4 @@ class Plugins { return(strcmp(strtolower($a[2]['name']),strtolower($b[2]['name']))); } - } \ No newline at end of file diff --git a/Zotlabs/Module/Admin/Themes.php b/Zotlabs/Module/Admin/Themes.php index fc908ec8b..8e72a1318 100644 --- a/Zotlabs/Module/Admin/Themes.php +++ b/Zotlabs/Module/Admin/Themes.php @@ -2,38 +2,41 @@ namespace Zotlabs\Module\Admin; +use \Michelf\MarkdownExtra; +/** + * @brief Admin area theme settings. + */ class Themes { + /** + * @brief + * + */ function post() { $theme = argv(2); if (is_file("view/theme/$theme/php/config.php")){ require_once("view/theme/$theme/php/config.php"); - // fixme add parent theme if derived - if (function_exists("theme_admin_post")){ + /// @FIXME add parent theme if derived + if (function_exists('theme_admin_post')){ theme_admin_post($a); } } info(t('Theme settings updated.')); - if(is_ajax()) + if(is_ajax()) return; - + goaway(z_root() . '/admin/themes/' . $theme ); } - - - /** * @brief Themes admin page. * - * @return string + * @return string with parsed HTML */ - function get(){ - $allowed_themes_str = get_config('system', 'allowed_themes'); $allowed_themes_raw = explode(',', $allowed_themes_str); $allowed_themes = array(); @@ -41,7 +44,7 @@ class Themes { foreach($allowed_themes_raw as $x) if(strlen(trim($x))) $allowed_themes[] = trim($x); - + $themes = array(); $files = glob('view/theme/*'); if($files) { @@ -53,56 +56,55 @@ class Themes { $themes[] = array('name' => $f, 'experimental' => $is_experimental, 'supported' => $is_supported, 'allowed' => $is_allowed); } } - + if(! count($themes)) { notice( t('No themes found.')); return ''; } - + /* * Single theme */ - + if (\App::$argc == 3){ $theme = \App::$argv[2]; if(! is_dir("view/theme/$theme")){ notice( t("Item not found.") ); return ''; } - + if (x($_GET,"a") && $_GET['a']=="t"){ check_form_security_token_redirectOnErr('/admin/themes', 'admin_themes', 't'); - + // Toggle theme status - + $this->toggle_theme($themes, $theme, $result); $s = $this->rebuild_theme_table($themes); if($result) info( sprintf('Theme %s enabled.', $theme)); else info( sprintf('Theme %s disabled.', $theme)); - + set_config('system', 'allowed_themes', $s); goaway(z_root() . '/admin/themes' ); } - + // display theme details - require_once('library/markdown.php'); - + if ($this->theme_status($themes,$theme)) { $status="on"; $action= t("Disable"); } else { $status="off"; $action= t("Enable"); } - + $readme=Null; if (is_file("view/theme/$theme/README.md")){ $readme = file_get_contents("view/theme/$theme/README.md"); - $readme = Markdown($readme); + $readme = MarkdownExtra::defaultTransform($readme); } else if (is_file("view/theme/$theme/README")){ - $readme = "
". file_get_contents("view/theme/$theme/README") ."
"; + $readme = '
'. file_get_contents("view/theme/$theme/README") .'
'; } - + $admin_form = ''; if (is_file("view/theme/$theme/php/config.php")){ require_once("view/theme/$theme/php/config.php"); @@ -110,11 +112,11 @@ class Themes { $admin_form = theme_admin($a); } } - + $screenshot = array( get_theme_screenshot($theme), t('Screenshot')); if(! stristr($screenshot[0],$theme)) $screenshot = null; - + $t = get_markup_template('admin_plugins_details.tpl'); return replace_macros($t, array( '$title' => t('Administration'), @@ -122,7 +124,7 @@ class Themes { '$toggle' => t('Toggle'), '$settings' => t('Settings'), '$baseurl' => z_root(), - + '$plugin' => $theme, '$status' => $status, '$action' => $action, @@ -133,22 +135,22 @@ class Themes { '$str_maintainer' => t('Maintainer: '), '$screenshot' => $screenshot, '$readme' => $readme, - + '$form_security_token' => get_form_security_token('admin_themes'), )); } - + /* * List themes */ - + $xthemes = array(); if($themes) { foreach($themes as $th) { $xthemes[] = array($th['name'],(($th['allowed']) ? "on" : "off"), get_theme_info($th['name'])); } } - + $t = get_markup_template('admin_plugins.tpl'); return replace_macros($t, array( '$title' => t('Administration'), @@ -162,13 +164,14 @@ class Themes { '$form_security_token' => get_form_security_token('admin_themes'), )); } - /** - * @param array $themes - * @param string $th - * @param int $result + * @brief Toggle a theme. + * + * @param array &$themes + * @param[in] string $th + * @param[out] int &$result */ function toggle_theme(&$themes, $th, &$result) { for($x = 0; $x < count($themes); $x ++) { @@ -184,7 +187,7 @@ class Themes { } } } - + /** * @param array $themes * @param string $th @@ -203,8 +206,7 @@ class Themes { } return 0; } - - + /** * @param array $themes * @return string @@ -222,12 +224,5 @@ class Themes { } return $o; } - - - - - - - } diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 15806ffc3..5e7307c7b 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -3,6 +3,7 @@ namespace Zotlabs\Module; use \Zotlabs\Lib as Zlib; +use \Michelf\MarkdownExtra; require_once('include/acl_selectors.php'); require_once('include/conversation.php'); @@ -242,8 +243,7 @@ class Wiki extends \Zotlabs\Web\Controller { $renderedContent = Zlib\NativeWikiPage::convert_links(zidify_links(smilies(bbcode($content))), argv(0) . '/' . argv(1) . '/' . $wikiUrlName); } else { - require_once('library/markdown.php'); - $html = Zlib\NativeWikiPage::generate_toc(zidify_text(purify_html(Markdown(Zlib\NativeWikiPage::bbcode($content))))); + $html = Zlib\NativeWikiPage::generate_toc(zidify_text(purify_html(MarkdownExtra::defaultTransform(Zlib\NativeWikiPage::bbcode($content))))); $renderedContent = Zlib\NativeWikiPage::convert_links($html, argv(0) . '/' . argv(1) . '/' . $wikiUrlName); } $showPageControls = $wiki_editor; -- cgit v1.2.3 From 18b22f5f8a7364ef94c51a7cf2f0a1d8b35fc5ad Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 27 Feb 2017 14:54:41 -0800 Subject: prep work --- Zotlabs/Module/Profiles.php | 1 + Zotlabs/Storage/Directory.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Profiles.php b/Zotlabs/Module/Profiles.php index d6c9d6570..f6e8b11ed 100644 --- a/Zotlabs/Module/Profiles.php +++ b/Zotlabs/Module/Profiles.php @@ -785,6 +785,7 @@ class Profiles extends \Zotlabs\Web\Controller { '$contact' => array('contact', t('Contact information and social networks'), $r[0]['contact']), '$channels' => array('channels', t('My other channels'), $r[0]['channels']), '$extra_fields' => $extra_fields, + '$comms' => t('Communications'), '$tel_label' => t('Phone'), '$email_label' => t('Email'), '$impp_label' => t('Instant messenger'), diff --git a/Zotlabs/Storage/Directory.php b/Zotlabs/Storage/Directory.php index 5d078b04e..51540735c 100644 --- a/Zotlabs/Storage/Directory.php +++ b/Zotlabs/Storage/Directory.php @@ -687,7 +687,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota { $ret = array(); $r = q("SELECT channel_id, channel_address FROM channel WHERE channel_removed = 0 - AND channel_system = 0 AND NOT (channel_pageflags & %d)>0", + AND channel_system = 0 AND (channel_pageflags & %d) = 0", intval(PAGE_HIDDEN) ); -- cgit v1.2.3 From 1325a81e9afaf53415411537ce8db5e2d554ae69 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 27 Feb 2017 15:13:49 -0800 Subject: add file size notes to /cloud actions panel --- Zotlabs/Storage/Browser.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Zotlabs') diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php index f527a6a44..21e91d2a2 100644 --- a/Zotlabs/Storage/Browser.php +++ b/Zotlabs/Storage/Browser.php @@ -322,12 +322,16 @@ class Browser extends DAV\Browser\Plugin { if(strpos($path,$special) === 0) $path = trim(substr($path,$count),'/'); + $info = t('Please use DAV to upload large (video, audio) files.
See Cloud Desktop Clients'); + + $output .= replace_macros(get_markup_template('cloud_actionspanel.tpl'), array( '$folder_header' => t('Create new folder'), '$folder_submit' => t('Create'), '$upload_header' => t('Upload file'), '$upload_submit' => t('Upload'), '$quota' => $quota, + '$info' => $info, '$channick' => $this->auth->owner_nick, '$aclselect' => $aclselect, '$allow_cid' => acl2json($channel_acl['allow_cid']), -- cgit v1.2.3 From 85082ea5098b3d8f375ca9bec7b3bbbdb9930bef Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 27 Feb 2017 21:14:09 -0800 Subject: fetch profile vcard for connection --- Zotlabs/Module/Connedit.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 7a753c286..db1def16c 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -441,6 +441,33 @@ class Connedit extends \Zotlabs\Web\Controller { goaway(z_root() . '/connedit/' . $contact_id); } + + if($cmd === 'fetchvc') { + $url = str_replace('/channel/','/profile/',$orig_record[0]['xchan_url']) . '/vcard'; + $x = z_fetch_url($url); + if($x['success']) { + $h = new \Zotlabs\Web\HTTPHeaders($x['header']); + $fields = $h->fetch(); + if($fields) { + foreach($fields as $y) { + if(array_key_exists('content-type',$y)) { + $type = explode(';',trim($y['content-type'])); + if($type && $type[0] === 'text/vcard' && $x['body']) { + $vc = \Sabre\VObject\Reader::read($x['body']); + $vcard = $vc->serialize(); + if($vcard) { + set_abconfig(local_channel(),$orig_record[0]['abook_xchan'],'system','vcard',$vcard); + $this->connedit_clone($a); + } + } + } + } + } + } + goaway(z_root() . '/connedit/' . $contact_id); + } + + if($cmd === 'resetphoto') { q("update xchan set xchan_photo_date = '2001-01-01 00:00:00' where xchan_hash = '%s'", dbesc($orig_record[0]['xchan_hash']) @@ -582,6 +609,13 @@ class Connedit extends \Zotlabs\Web\Controller { 'sel' => '', 'title' => t('Fetch updated permissions'), ), + + 'rephoto' => array( + 'label' => t('Refresh Photo'), + 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/resetphoto', + 'sel' => '', + 'title' => t('Fetch updated photo'), + ), 'recent' => array( 'label' => t('Recent Activity'), @@ -631,6 +665,17 @@ class Connedit extends \Zotlabs\Web\Controller { ); + + if($contact['xchan_network'] === 'zot') { + $tools['fetchvc'] = [ + 'label' => t('Fetch Vcard'), + 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/fetchvc', + 'sel' => '', + 'title' => t('Fetch electronic calling card for this connection') + ]; + } + + $sections = []; $sections['perms'] = [ -- cgit v1.2.3 From df6e75e1d6eede898e663cc63b346f118767aba5 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 27 Feb 2017 23:37:42 -0800 Subject: make magic-auth work with profile vcard fetch --- Zotlabs/Module/Connedit.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index db1def16c..229f0dfe3 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -444,7 +444,8 @@ class Connedit extends \Zotlabs\Web\Controller { if($cmd === 'fetchvc') { $url = str_replace('/channel/','/profile/',$orig_record[0]['xchan_url']) . '/vcard'; - $x = z_fetch_url($url); + $recurse = 0; + $x = z_fetch_url(zid($url),false,$recurse,['headers' => ['Cookie: PHPSESSID=' . session_id()]]); if($x['success']) { $h = new \Zotlabs\Web\HTTPHeaders($x['header']); $fields = $h->fetch(); -- cgit v1.2.3 From fa944fc52646219d69f910d7cd4750db9c8f11bd Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 27 Feb 2017 23:48:54 -0800 Subject: provide 'session' option to z_fetch_url to assist with remote fetches requiring magic auth --- Zotlabs/Module/Connedit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 229f0dfe3..5b7c23028 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -445,7 +445,7 @@ class Connedit extends \Zotlabs\Web\Controller { if($cmd === 'fetchvc') { $url = str_replace('/channel/','/profile/',$orig_record[0]['xchan_url']) . '/vcard'; $recurse = 0; - $x = z_fetch_url(zid($url),false,$recurse,['headers' => ['Cookie: PHPSESSID=' . session_id()]]); + $x = z_fetch_url(zid($url),false,$recurse,['session' => true]); if($x['success']) { $h = new \Zotlabs\Web\HTTPHeaders($x['header']); $fields = $h->fetch(); -- cgit v1.2.3 From df57e7ab93254d063b453a68f15d254079450cf9 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 28 Feb 2017 14:56:26 -0800 Subject: expire unread system notifications after a year. It would provide a better experience for infrequent visitors if we didn't expire them at all, but at some point we need to draw a line so as not to degrade system performance searching through old notifications that it's highly unlikely will ever be viewed again. --- Zotlabs/Daemon/Cron_daily.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php index 0f0001890..038790572 100644 --- a/Zotlabs/Daemon/Cron_daily.php +++ b/Zotlabs/Daemon/Cron_daily.php @@ -38,6 +38,13 @@ class Cron_daily { db_utcnow(), db_quoteinterval('30 DAY') ); + // expire any unread notifications over a year old + + q("delete from notify where seen = 0 and created < %s - INTERVAL %s", + db_utcnow(), db_quoteinterval('1 YEAR') + ); + + //update statistics in config require_once('include/statistics_fns.php'); update_channels_total_stat(); -- cgit v1.2.3 From d7e24b24945a909f2bf2825200234db622a8e9fb Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 1 Mar 2017 20:05:52 -0800 Subject: make system.expire_delivery_reports default setting consistent (10 days) --- Zotlabs/Lib/ThreadItem.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 07b782309..799a606d6 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -276,7 +276,7 @@ class ThreadItem { $keep_reports = intval(get_config('system','expire_delivery_reports')); if($keep_reports === 0) - $keep_reports = 30; + $keep_reports = 10; if((! get_config('system','disable_dreport')) && strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC',"now - $keep_reports days")) > 0) $dreport = t('Delivery Report'); -- cgit v1.2.3 From dd8a3d845e274231bc53326f32685ec2431af2fa Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 2 Mar 2017 11:36:35 +0100 Subject: reset schema value after we empty and repopulate it. second half of fix for #624 --- Zotlabs/Module/Settings/Display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index ee404daba..eae44e82c 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -65,7 +65,7 @@ class Display { set_pconfig(local_channel(),'system','manual_conversation_update', $manual_update); $newschema = ''; - if($theme == $existing_theme){ + if($theme){ // call theme_post only if theme has not been changed if( ($themeconfigfile = $this->get_theme_config_file($theme)) != null){ require_once($themeconfigfile); -- cgit v1.2.3 From e58dc726c5e40ff30942739f86d2329fb29f763c Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 2 Mar 2017 17:32:43 -0800 Subject: activity widget - like the forum widget but represents unseen activity by author. Still experimental until it can be tested with diaspora xchans, which may require additional urlencoding. --- Zotlabs/Module/Channel.php | 1 + Zotlabs/Module/Display.php | 1 + Zotlabs/Module/Network.php | 25 +++++++++++++++++++++++-- Zotlabs/Module/Pubstream.php | 1 + Zotlabs/Module/Search.php | 1 + Zotlabs/Module/Settings/Channel.php | 4 ++-- 6 files changed, 29 insertions(+), 4 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 0d20e0080..1bfecf2f6 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -321,6 +321,7 @@ class Channel extends \Zotlabs\Web\Controller { '$static' => $static, '$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1), '$search' => '', + '$xchan' => '', '$order' => '', '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), '$file' => '', diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index a4d59a1b6..815672091 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -165,6 +165,7 @@ class Display extends \Zotlabs\Web\Controller { '$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1), '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), '$search' => '', + '$xchan' => '', '$order' => '', '$file' => '', '$cats' => '', diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 8263420b6..1c7c70019 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -118,8 +118,8 @@ class Network extends \Zotlabs\Web\Controller { $cmax = ((x($_GET,'cmax')) ? intval($_GET['cmax']) : 99); $firehose = ((x($_GET,'fh')) ? intval($_GET['fh']) : 0); $file = ((x($_GET,'file')) ? $_GET['file'] : ''); - - + $xchan = ((x($_GET,'xchan')) ? $_GET['xchan'] : ''); + $deftag = ''; if(x($_GET,'search') || x($_GET,'file')) @@ -257,6 +257,26 @@ class Network extends \Zotlabs\Web\Controller { goaway(z_root() . '/network'); } } + elseif($xchan) { + $r = q("select * from xchan where xchan_hash = '%s'", + dbesc($xchan) + ); + if($r) { + $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($xchan) . "' or owner_xchan = '" . dbesc($xchan) . "' ) $item_normal ) "; + $title = replace_macros(get_markup_template("section_title.tpl"),array( + '$title' => '' . urlencode($r[0]['xchan_name']) . ' ' . $r[0]['xchan_name'] . '' + )); + $o = $tabs; + $o .= $title; + $o .= $status_editor; + + } + else { + notice( t('Invalid channel.') . EOL); + goaway(z_root() . '/network'); + } + + } if(x($category)) { $sql_extra .= protect_sprintf(term_query('item', $category, TERM_CATEGORY)); @@ -302,6 +322,7 @@ class Network extends \Zotlabs\Web\Controller { '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), '$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1), '$search' => (($search) ? $search : ''), + '$xchan' => $xchan, '$order' => $order, '$file' => $file, '$cats' => $category, diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 6c4d479d4..46210abb1 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -57,6 +57,7 @@ class Pubstream extends \Zotlabs\Web\Controller { '$static' => $static, '$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1), '$search' => '', + '$xchan' => '', '$order' => 'comment', '$file' => '', '$cats' => '', diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php index 89eaa4ffa..aacdc88e7 100644 --- a/Zotlabs/Module/Search.php +++ b/Zotlabs/Module/Search.php @@ -130,6 +130,7 @@ class Search extends \Zotlabs\Web\Controller { '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), '$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1), '$search' => (($tag) ? urlencode('#') : '') . $search, + '$xchan' => '', '$order' => '', '$file' => '', '$cats' => '', diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php index 5b9cfdaca..8eb3b2181 100644 --- a/Zotlabs/Module/Settings/Channel.php +++ b/Zotlabs/Module/Settings/Channel.php @@ -277,8 +277,8 @@ class Channel { if($email_changed && \App::$config['system']['register_policy'] == REGISTER_VERIFY) { // FIXME - set to un-verified, blocked and redirect to logout - // Why? Are we verifying people or email addresses? - + // Q: Why? Are we verifying people or email addresses? + // A: the policy is to verify email addresses } goaway(z_root() . '/settings' ); -- cgit v1.2.3 From eaefb362129b9d1731d809822232f1d35c95b871 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 4 Mar 2017 16:56:52 +0100 Subject: we need item edited for wiki page history, not item created --- Zotlabs/Lib/NativeWikiPage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php index af0286997..25e454cb7 100644 --- a/Zotlabs/Lib/NativeWikiPage.php +++ b/Zotlabs/Lib/NativeWikiPage.php @@ -188,7 +188,7 @@ class NativeWikiPage { $processed ++; $history[] = [ 'revision' => $item['revision'], - 'date' => datetime_convert('UTC',date_default_timezone_get(),$item['created']), + 'date' => datetime_convert('UTC',date_default_timezone_get(),$item['edited']), 'name' => $item['author']['xchan_name'], 'title' => get_iconfig($item,'nwikipage','commit_msg') ]; -- cgit v1.2.3 From 9e44b0727513d820336cd4c51350d62b13cf8479 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 6 Mar 2017 22:32:05 +0100 Subject: allow unauthenticated access to public wiki pages --- Zotlabs/Lib/NativeWikiPage.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php index 25e454cb7..e9f8a32c9 100644 --- a/Zotlabs/Lib/NativeWikiPage.php +++ b/Zotlabs/Lib/NativeWikiPage.php @@ -232,7 +232,11 @@ class NativeWikiPage { } } - $sql_extra = item_permissions_sql($channel_id,$observer_hash); + $sql_extra = ''; + + if($w['wiki']['allow_cid'] || $w['wiki']['allow_gid'] || $w['wiki']['deny_cid'] || $w['wiki']['deny_gid']) + $sql_extra .= item_permissions_sql($channel_id,$observer_hash); + if($revision == (-1)) $sql_extra .= " order by revision desc "; elseif($revision) @@ -284,7 +288,11 @@ class NativeWikiPage { } } - $sql_extra = item_permissions_sql($channel_id,$observer_hash); + $sql_extra = ''; + + if($w['wiki']['allow_cid'] || $w['wiki']['allow_gid'] || $w['wiki']['deny_cid'] || $w['wiki']['deny_gid']) + $sql_extra .= item_permissions_sql($channel_id,$observer_hash); + $sql_extra .= " order by revision desc "; $r = null; -- cgit v1.2.3 From 595cb13d8f2793fcefdc1566715848479460e479 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 6 Mar 2017 15:33:10 -0800 Subject: correct fix for wiki anonymous read issue (items_permissions_sql checks item.public_policy which was set for posts, not wikis) --- Zotlabs/Lib/NativeWikiPage.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php index e9f8a32c9..941ade90c 100644 --- a/Zotlabs/Lib/NativeWikiPage.php +++ b/Zotlabs/Lib/NativeWikiPage.php @@ -64,6 +64,8 @@ class NativeWikiPage { $arr['deny_cid'] = $w['wiki']['deny_cid']; $arr['deny_gid'] = $w['wiki']['deny_gid']; + $arr['public_policy'] = map_scope(\Zotlabs\Access\PermissionLimits::Get($channel_id,'view_wiki'),true); + // We may wish to change this some day. $arr['item_unpublished'] = 1; @@ -232,10 +234,7 @@ class NativeWikiPage { } } - $sql_extra = ''; - - if($w['wiki']['allow_cid'] || $w['wiki']['allow_gid'] || $w['wiki']['deny_cid'] || $w['wiki']['deny_gid']) - $sql_extra .= item_permissions_sql($channel_id,$observer_hash); + $sql_extra = item_permissions_sql($channel_id,$observer_hash); if($revision == (-1)) $sql_extra .= " order by revision desc "; @@ -288,10 +287,7 @@ class NativeWikiPage { } } - $sql_extra = ''; - - if($w['wiki']['allow_cid'] || $w['wiki']['allow_gid'] || $w['wiki']['deny_cid'] || $w['wiki']['deny_gid']) - $sql_extra .= item_permissions_sql($channel_id,$observer_hash); + $sql_extra = item_permissions_sql($channel_id,$observer_hash); $sql_extra .= " order by revision desc "; -- cgit v1.2.3 From a18e8e1ede672f8733ef41250099880836efa7f7 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 6 Mar 2017 17:59:34 -0800 Subject: add public_policy to the nwiki container also. This should not affect the recent bug as presented, but is being added for consistency. --- Zotlabs/Lib/NativeWiki.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/NativeWiki.php b/Zotlabs/Lib/NativeWiki.php index 519102d24..7786ec25a 100644 --- a/Zotlabs/Lib/NativeWiki.php +++ b/Zotlabs/Lib/NativeWiki.php @@ -75,6 +75,8 @@ class NativeWiki { $arr['obj_type'] = ACTIVITY_OBJ_WIKI; $arr['body'] = '[table][tr][td][h1]New Wiki[/h1][/td][/tr][tr][td][zrl=' . $wiki_url . ']' . $wiki['htmlName'] . '[/zrl][/td][/tr][/table]'; + $arr['public_policy'] = map_scope(\Zotlabs\Access\PermissionLimits::Get($channel['channel_id'],'view_wiki'),true); + // Save the wiki name information using iconfig. This is shareable. if(! set_iconfig($arr, 'wiki', 'rawName', $wiki['rawName'], true)) { return array('item' => null, 'success' => false); -- cgit v1.2.3 From 403f4c1a6b57f165b098688d4896414f9181ffde Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 8 Mar 2017 19:23:11 -0800 Subject: Monday is a proper name and should be capitalised (except in private conversation amongst unix geeks). --- Zotlabs/Module/Settings/Channel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php index 8eb3b2181..56a7d0d8e 100644 --- a/Zotlabs/Module/Settings/Channel.php +++ b/Zotlabs/Module/Settings/Channel.php @@ -575,7 +575,7 @@ class Channel { '$removeme' => t('Remove Channel'), '$removechannel' => t('Remove this channel.'), '$firefoxshare' => t('Firefox Share $Projectname provider'), - '$cal_first_day' => array('first_day', t('Start calendar week on monday'), ((get_pconfig(local_channel(),'system','cal_first_day')) ? 1 : ''), '', $yes_no), + '$cal_first_day' => array('first_day', t('Start calendar week on Monday'), ((get_pconfig(local_channel(),'system','cal_first_day')) ? 1 : ''), '', $yes_no), )); call_hooks('settings_form',$o); -- cgit v1.2.3 From 8aabc6bc3dfccb85f44b5db4708a756124277e1e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 12 Mar 2017 21:11:28 +0100 Subject: many dropdown and class fixes. still a long way to go... --- Zotlabs/Lib/ThreadItem.php | 4 ++-- Zotlabs/Module/Lockview.php | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 799a606d6..6534a5345 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -183,7 +183,7 @@ class ThreadItem { $like_list = ((x($conv_responses['like'],$item['mid'])) ? $conv_responses['like'][$item['mid'] . '-l'] : ''); if (count($like_list) > MAX_LIKERS) { $like_list_part = array_slice($like_list, 0, MAX_LIKERS); - array_push($like_list_part, '' . t('View all') . ''); + array_push($like_list_part, '' . t('View all') . ''); } else { $like_list_part = ''; } @@ -195,7 +195,7 @@ class ThreadItem { $dislike_button_label = tt('Dislike','Dislikes',$dislike_count,'noun'); if (count($dislike_list) > MAX_LIKERS) { $dislike_list_part = array_slice($dislike_list, 0, MAX_LIKERS); - array_push($dislike_list_part, '' . t('View all') . ''); + array_push($dislike_list_part, '' . t('View all') . ''); } else { $dislike_list_part = ''; } diff --git a/Zotlabs/Module/Lockview.php b/Zotlabs/Module/Lockview.php index fc7d5c7c8..466d16997 100644 --- a/Zotlabs/Module/Lockview.php +++ b/Zotlabs/Module/Lockview.php @@ -72,7 +72,7 @@ class Lockview extends \Zotlabs\Web\Controller { } if($uid != local_channel()) { - echo '
  • ' . t('Remote privacy information not available.') . '
  • '; + echo ''; killme(); } @@ -84,7 +84,7 @@ class Lockview extends \Zotlabs\Web\Controller { // as unknown specific recipients. The sender will have the visibility list and will fall through to the // next section. - echo '
  • ' . translate_scope((! $item['public_policy']) ? 'specific' : $item['public_policy']) . '
  • '; + echo ''; killme(); } @@ -93,7 +93,7 @@ class Lockview extends \Zotlabs\Web\Controller { $deny_users = expand_acl($item['deny_cid']); $deny_groups = expand_acl($item['deny_gid']); - $o = '
  • ' . t('Visible to:') . '
  • '; + $o = ''; $l = array(); stringify_array_elms($allowed_groups,true); @@ -114,24 +114,24 @@ class Lockview extends \Zotlabs\Web\Controller { $r = q("SELECT profile_name FROM profile WHERE profile_guid IN ( " . implode(', ', $profile_groups) . " )"); if($r) foreach($r as $rr) - $l[] = '
  • ' . t('Profile','acl') . ' ' . $rr['profile_name'] . '
  • '; + $l[] = ''; } if(count($allowed_groups)) { $r = q("SELECT gname FROM groups WHERE hash IN ( " . implode(', ', $allowed_groups) . " )"); if($r) foreach($r as $rr) - $l[] = '
  • ' . $rr['gname'] . '
  • '; + $l[] = ''; } if(count($allowed_users)) { $r = q("SELECT xchan_name FROM xchan WHERE xchan_hash IN ( " . implode(', ',$allowed_users) . " )"); if($r) foreach($r as $rr) - $l[] = '
  • ' . $rr['xchan_name'] . '
  • '; + $l[] = ''; if($atokens) { foreach($atokens as $at) { if(in_array("'" . $at['xchan_hash'] . "'",$allowed_users)) { - $l[] = '
  • ' . $at['xchan_name'] . '
  • '; + $l[] = ''; } } } @@ -150,7 +150,7 @@ class Lockview extends \Zotlabs\Web\Controller { $r = q("SELECT profile_name FROM profile WHERE profile_guid IN ( " . implode(', ', $profile_groups) . " )"); if($r) foreach($r as $rr) - $l[] = '
  • ' . t('Profile','acl') . ' ' . $rr['profile_name'] . '
  • '; + $l[] = ''; } @@ -159,18 +159,18 @@ class Lockview extends \Zotlabs\Web\Controller { $r = q("SELECT gname FROM groups WHERE hash IN ( " . implode(', ', $deny_groups) . " )"); if($r) foreach($r as $rr) - $l[] = '
  • ' . $rr['gname'] . '
  • '; + $l[] = ''; } if(count($deny_users)) { $r = q("SELECT xchan_name FROM xchan WHERE xchan_hash IN ( " . implode(', ', $deny_users) . " )"); if($r) foreach($r as $rr) - $l[] = '
  • ' . $rr['xchan_name'] . '
  • '; + $l[] = ''; if($atokens) { foreach($atokens as $at) { if(in_array("'" . $at['xchan_hash'] . "'",$deny_users)) { - $l[] = '
  • ' . $at['xchan_name'] . '
  • '; + $l[] = ''; } } } -- cgit v1.2.3 From 700c05a55bab34c40f24fbe4f83a0fa9882559b2 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 13 Mar 2017 16:34:23 +0100 Subject: many class fixes and revive shiny class for item titles in a new way --- Zotlabs/Lib/ThreadItem.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 6534a5345..c3464b86b 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -82,7 +82,8 @@ class ThreadItem { $dropping = false; $star = false; $isstarred = "unstarred fa-star-o"; - $indent = ''; + $is_comment = false; + $is_item = false; $osparkle = ''; $total_children = $this->count_descendants(); $unseen_comments = (($item['real_uid']) ? 0 : $this->count_unseen_descendants()); @@ -232,7 +233,7 @@ class ThreadItem { } } else { - $indent = 'comment'; + $is_comment = true; } @@ -282,7 +283,7 @@ class ThreadItem { $dreport = t('Delivery Report'); if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0) - $indent .= ' shiny'; + $is_new = true; localize_item($item); @@ -361,7 +362,8 @@ class ThreadItem { 'attend_title' => t('Attendance Options'), 'vote_label' => t('Vote'), 'vote_title' => t('Voting Options'), - 'indent' => $indent, + 'is_comment' => $is_comment, + 'is_new' => $is_new, 'owner_url' => $this->get_owner_url(), 'owner_photo' => $this->get_owner_photo(), 'owner_name' => $this->get_owner_name(), @@ -407,7 +409,7 @@ class ThreadItem { 'showlike' => $showlike, 'showdislike' => $showdislike, 'comment' => $this->get_comment_box($indent), - 'previewing' => ($conv->is_preview() ? ' preview ' : ''), + 'previewing' => ($conv->is_preview() ? true : false ), 'wait' => t('Please wait'), 'submid' => str_replace(['+','='], ['',''], base64_encode(substr($item['mid'],0,32))), 'thread_level' => $thread_level -- cgit v1.2.3 From 62c921815fcc832d550c5c453284e911da10692f Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 15 Mar 2017 12:38:33 +0100 Subject: better handling of mimetype security --- Zotlabs/Module/Editwebpage.php | 2 -- Zotlabs/Module/Item.php | 22 ++++++---------------- 2 files changed, 6 insertions(+), 18 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Editwebpage.php b/Zotlabs/Module/Editwebpage.php index 3d4af107d..97f4a32ff 100644 --- a/Zotlabs/Module/Editwebpage.php +++ b/Zotlabs/Module/Editwebpage.php @@ -130,8 +130,6 @@ class Editwebpage extends \Zotlabs\Web\Controller { $layout = $itm[0]['layout_mid']; - $tpl = get_markup_template("jot.tpl"); - $rp = 'webpages/' . $which; $x = array( diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 4725ecb38..6f54d3bb1 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -480,22 +480,12 @@ class Item extends \Zotlabs\Web\Controller { $execflag = false; - if($mimetype !== 'text/bbcode') { - $z = q("select account_id, account_roles, channel_pageflags from account left join channel on channel_account_id = account_id where channel_id = %d limit 1", - intval($profile_uid) - ); - if($z && (($z[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($z[0]['channel_pageflags'] & PAGE_ALLOWCODE))) { - if($uid && (get_account_id() == $z[0]['account_id'])) { - $execflag = true; - } - else { - notice( t('Executable content type not permitted to this channel.') . EOL); - if($api_source) - return ( [ 'success' => false, 'message' => 'forbidden content type' ] ); - if(x($_REQUEST,'return')) - goaway(z_root() . "/" . $return_path ); - killme(); - } + $z = q("select account_id, account_roles, channel_pageflags from account left join channel on channel_account_id = account_id where channel_id = %d limit 1", + intval($profile_uid) + ); + if($z && (($z[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($z[0]['channel_pageflags'] & PAGE_ALLOWCODE))) { + if($uid && (get_account_id() == $z[0]['account_id'])) { + $execflag = true; } } -- cgit v1.2.3 From d10525a375884850b1b643796b839747cbc623b2 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 17 Mar 2017 14:22:10 +0100 Subject: fix item_list and item_search templates. make item filer use a bootdtrap modal and some css and class fixes --- Zotlabs/Module/Filer.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Filer.php b/Zotlabs/Module/Filer.php index 6a57cdb2a..af59f28fb 100644 --- a/Zotlabs/Module/Filer.php +++ b/Zotlabs/Module/Filer.php @@ -49,8 +49,10 @@ class Filer extends \Zotlabs\Web\Controller { } $tpl = get_markup_template("filer_dialog.tpl"); $o = replace_macros($tpl, array( - '$field' => array('term', t("Save to Folder:"), '', '', $filetags, t('- select -')), + '$field' => array('term', t('Enter a folder name'), '', '', $filetags, 'placeholder="' . t('or select an existing folder (doubleclick)') . '"'), '$submit' => t('Save'), + '$title' => t('Save to Folder'), + '$cancel' => t('Cancel') )); echo $o; -- cgit v1.2.3 From cbd401c3e8f7d20a32089af9074c60e266f30da7 Mon Sep 17 00:00:00 2001 From: Klaus Date: Sat, 18 Mar 2017 11:35:19 +0100 Subject: Missed one old Markdown() --- Zotlabs/Module/Wiki.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 5e7307c7b..42de8db50 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -327,9 +327,8 @@ class Wiki extends \Zotlabs\Web\Controller { $html = Zlib\NativeWikiPage::convert_links(zidify_links(smilies(bbcode($content))),$wikiURL); } else { - require_once('library/markdown.php'); $content = Zlib\NativeWikiPage::bbcode($content); - $html = Zlib\NativeWikiPage::generate_toc(zidify_text(purify_html(Markdown($content)))); + $html = Zlib\NativeWikiPage::generate_toc(zidify_text(purify_html(MarkdownExtra::defaultTransform($content)))); $html = Zlib\NativeWikiPage::convert_links($html,$wikiURL); } json_return_and_die(array('html' => $html, 'success' => true)); -- cgit v1.2.3 From 82b35e27620e97eb01ab55fe97b55c9ec8e05b81 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 18 Mar 2017 20:00:32 +0100 Subject: fix abook_edit and private mail --- Zotlabs/Module/Settings/Permcats.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Settings/Permcats.php b/Zotlabs/Module/Settings/Permcats.php index 35d533196..90dc526bf 100644 --- a/Zotlabs/Module/Settings/Permcats.php +++ b/Zotlabs/Module/Settings/Permcats.php @@ -114,4 +114,4 @@ logger('cmd: ' . \App::$cmd); return $o; } -} \ No newline at end of file +} -- cgit v1.2.3 From d2c971eda99fadb7515fb1e1ea4bd645a52513bd Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 19 Mar 2017 13:33:02 +0100 Subject: fix php warning and remove logging --- Zotlabs/Module/Settings/Permcats.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Settings/Permcats.php b/Zotlabs/Module/Settings/Permcats.php index 35d533196..336f69653 100644 --- a/Zotlabs/Module/Settings/Permcats.php +++ b/Zotlabs/Module/Settings/Permcats.php @@ -42,8 +42,6 @@ class Permcats { function get() { -logger('cmd: ' . \App::$cmd); - if(! local_channel()) return; @@ -85,7 +83,7 @@ logger('cmd: ' . \App::$cmd); if($existing[$k]) $thisperm = "1"; - $perms[] = array('perms_' . $k, $v, ((array_key_exists($k,$their_perms)) ? intval($their_perms[$k]) : ''),$thisperm, 1, (($checkinherited & PERMS_SPECIFIC) ? '' : '1'), '', $checkinherited); + $perms[] = array('perms_' . $k, $v, '',$thisperm, 1, (($checkinherited & PERMS_SPECIFIC) ? '' : '1'), '', $checkinherited); } @@ -114,4 +112,4 @@ logger('cmd: ' . \App::$cmd); return $o; } -} \ No newline at end of file +} -- cgit v1.2.3 From ca14ab3d555476861cf60063208249676aae8954 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 20 Mar 2017 17:24:48 +0100 Subject: move profile tabs to app-tray --- Zotlabs/Module/Bookmarks.php | 3 ++- Zotlabs/Module/Cal.php | 3 ++- Zotlabs/Module/Channel.php | 2 +- Zotlabs/Module/Chat.php | 3 ++- Zotlabs/Module/Photos.php | 2 +- Zotlabs/Module/Profile.php | 2 +- Zotlabs/Module/Sharedwithme.php | 3 ++- Zotlabs/Module/Webpages.php | 3 ++- Zotlabs/Module/Wiki.php | 3 ++- Zotlabs/Storage/Browser.php | 3 ++- 10 files changed, 17 insertions(+), 10 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Bookmarks.php b/Zotlabs/Module/Bookmarks.php index 733bfd4e3..682f8e76c 100644 --- a/Zotlabs/Module/Bookmarks.php +++ b/Zotlabs/Module/Bookmarks.php @@ -68,7 +68,8 @@ class Bookmarks extends \Zotlabs\Web\Controller { $channel = \App::get_channel(); - $o = profile_tabs($a,true,$channel['channel_address']); + //$o = profile_tabs($a,true,$channel['channel_address']); + $o = ''; $o .= '
    '; diff --git a/Zotlabs/Module/Cal.php b/Zotlabs/Module/Cal.php index b982d19a8..41676ce02 100644 --- a/Zotlabs/Module/Cal.php +++ b/Zotlabs/Module/Cal.php @@ -86,7 +86,8 @@ class Cal extends \Zotlabs\Web\Controller { $o = ''; - $tabs = profile_tabs($a, True, $channel['channel_address']); + //$tabs = profile_tabs($a, True, $channel['channel_address']); + $tabs = ''; $mode = 'view'; $y = 0; diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 1bfecf2f6..61df35a60 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -121,7 +121,7 @@ class Channel extends \Zotlabs\Web\Controller { $static = channel_manual_conv_update(\App::$profile['profile_uid']); - $o .= profile_tabs($a, $is_owner, \App::$profile['channel_address']); + //$o .= profile_tabs($a, $is_owner, \App::$profile['channel_address']); $o .= common_friends_visitor_widget(\App::$profile['profile_uid']); diff --git a/Zotlabs/Module/Chat.php b/Zotlabs/Module/Chat.php index febfd51e5..23a3e65da 100644 --- a/Zotlabs/Module/Chat.php +++ b/Zotlabs/Module/Chat.php @@ -210,7 +210,8 @@ class Chat extends \Zotlabs\Web\Controller { require_once('include/conversation.php'); - $o = profile_tabs($a,((local_channel() && local_channel() == \App::$profile['profile_uid']) ? true : false),\App::$profile['channel_address']); + //$o = profile_tabs($a,((local_channel() && local_channel() == \App::$profile['profile_uid']) ? true : false),\App::$profile['channel_address']); + $o = ''; if(! feature_enabled(\App::$profile['profile_uid'],'ajaxchat')) { notice( t('Feature disabled.') . EOL); diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index 582174d0e..34fedb14e 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -579,7 +579,7 @@ class Photos extends \Zotlabs\Web\Controller { // tabs $_is_owner = (local_channel() && (local_channel() == $owner_uid)); - $o .= profile_tabs($a,$_is_owner, \App::$data['channel']['channel_address']); + //$o .= profile_tabs($a,$_is_owner, \App::$data['channel']['channel_address']); /** * Display upload form diff --git a/Zotlabs/Module/Profile.php b/Zotlabs/Module/Profile.php index fda88da52..ab349b05d 100644 --- a/Zotlabs/Module/Profile.php +++ b/Zotlabs/Module/Profile.php @@ -101,7 +101,7 @@ class Profile extends \Zotlabs\Web\Controller { return; } - $o .= profile_tabs($a, $is_owner, \App::$profile['channel_address']); + //$o .= profile_tabs($a, $is_owner, \App::$profile['channel_address']); \App::$page['htmlhead'] .= "\r\n" . '' . "\r\n"; diff --git a/Zotlabs/Module/Sharedwithme.php b/Zotlabs/Module/Sharedwithme.php index 25bc7dba3..5d6d0f7da 100644 --- a/Zotlabs/Module/Sharedwithme.php +++ b/Zotlabs/Module/Sharedwithme.php @@ -92,7 +92,8 @@ class Sharedwithme extends \Zotlabs\Web\Controller { } - $o = profile_tabs($a, $is_owner, $channel['channel_address']); + //$o = profile_tabs($a, $is_owner, $channel['channel_address']); + $o = ''; $o .= replace_macros(get_markup_template('sharedwithme.tpl'), array( '$header' => t('Files: shared with me'), diff --git a/Zotlabs/Module/Webpages.php b/Zotlabs/Module/Webpages.php index 46b94f091..effe92614 100644 --- a/Zotlabs/Module/Webpages.php +++ b/Zotlabs/Module/Webpages.php @@ -142,7 +142,8 @@ class Webpages extends \Zotlabs\Web\Controller { $is_owner = ($uid && $uid == $owner); - $o = profile_tabs($a, $is_owner, \App::$profile['channel_address']); + //$o = profile_tabs($a, $is_owner, \App::$profile['channel_address']); + $o = ''; $x = array( 'webpage' => ITEM_TYPE_WEBPAGE, diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 42de8db50..948c67c09 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -107,7 +107,8 @@ class Wiki extends \Zotlabs\Web\Controller { } $is_owner = ((local_channel()) && (local_channel() == \App::$profile['profile_uid']) ? true : false); - $o = profile_tabs($a, $is_owner, \App::$profile['channel_address']); + //$o = profile_tabs($a, $is_owner, \App::$profile['channel_address']); + $o = ''; // Download a wiki /* diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php index 21e91d2a2..3fdc8e9d4 100644 --- a/Zotlabs/Storage/Browser.php +++ b/Zotlabs/Storage/Browser.php @@ -84,7 +84,8 @@ class Browser extends DAV\Browser\Plugin { require_once('include/conversation.php'); require_once('include/text.php'); if ($this->auth->owner_nick) { - $html = profile_tabs(get_app(), (($is_owner) ? true : false), $this->auth->owner_nick); + //$html = profile_tabs(get_app(), (($is_owner) ? true : false), $this->auth->owner_nick); + $html = ''; } $files = $this->server->getPropertiesForPath($path, array( -- cgit v1.2.3 From 49e77e0f71d6140608db0fa6b9db2a4ad64b384a Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Thu, 23 Mar 2017 23:40:12 +0100 Subject: Import Module documentation and @-sign replacement. If you copy the identity from your profile page the @-sign is invalid for the import and fails. Replace it for convenience. --- Zotlabs/Module/Import.php | 226 +++++++++++++++++++++++----------------------- 1 file changed, 115 insertions(+), 111 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php index 3969f25e0..55c1a8d8b 100644 --- a/Zotlabs/Module/Import.php +++ b/Zotlabs/Module/Import.php @@ -2,26 +2,32 @@ namespace Zotlabs\Module; -// Import a channel, either by direct file upload or via -// connection to original server. - - require_once('include/zot.php'); require_once('include/channel.php'); require_once('include/import.php'); require_once('include/perm_upgrade.php'); - +/** + * @brief Module for channel import. + * + * Import a channel, either by direct file upload or via + * connection to another server. + */ class Import extends \Zotlabs\Web\Controller { + /** + * @brief Import channel into account. + * + * @param int $account_id + */ function import_account($account_id) { - + if(! $account_id){ - logger("import_account: No account ID supplied"); + logger('No account ID supplied'); return; } - + $max_friends = account_service_class_fetch($account_id,'total_channels'); $max_feeds = account_service_class_fetch($account_id,'total_feeds'); $data = null; @@ -32,35 +38,39 @@ class Import extends \Zotlabs\Web\Controller { $filename = basename($_FILES['filename']['name']); $filesize = intval($_FILES['filename']['size']); $filetype = $_FILES['filename']['type']; - + // import channel from file if($src) { - - // This is OS specific and could also fail if your tmpdir isn't very large - // mostly used for Diaspora which exports gzipped files. - + + // This is OS specific and could also fail if your tmpdir isn't very + // large mostly used for Diaspora which exports gzipped files. + if(strpos($filename,'.gz')){ @rename($src,$src . '.gz'); @system('gunzip ' . escapeshellarg($src . '.gz')); } - + if($filesize) { $data = @file_get_contents($src); } unlink($src); } - + + // import channel from another server if(! $src) { $old_address = ((x($_REQUEST,'old_address')) ? $_REQUEST['old_address'] : ''); if(! $old_address) { - logger('mod_import: nothing to import.'); + logger('Nothing to import.'); notice( t('Nothing to import.') . EOL); return; + } else if(strpos($old_address, 'ï¼ ')) { + // if you copy the identity address from your profile page, make it work for convenience + $old_address = str_replace('ï¼ ', '@', $old_address); } - + $email = ((x($_REQUEST,'email')) ? $_REQUEST['email'] : ''); $password = ((x($_REQUEST,'password')) ? $_REQUEST['password'] : ''); - + $channelname = substr($old_address,0,strpos($old_address,'@')); $servername = substr($old_address,strpos($old_address,'@')+1); @@ -85,19 +95,18 @@ class Import extends \Zotlabs\Web\Controller { return; } } - + if(! $data) { - logger('mod_import: empty file.'); + logger('Empty import file.'); notice( t('Imported file is empty.') . EOL); return; } - + $data = json_decode($data,true); - + // logger('import: data: ' . print_r($data,true)); // print_r($data); - - + if(! array_key_exists('compatibility',$data)) { call_hooks('import_foreign_channel_data',$data); if($data['handled']) @@ -108,24 +117,24 @@ class Import extends \Zotlabs\Web\Controller { $v1 = substr($data['compatibility']['database'],-4); $v2 = substr(DB_UPDATE_VERSION,-4); if($v2 > $v1) { - $t = sprintf( t('Warning: Database versions differ by %1$d updates.'), $v2 - $v1 ); + $t = sprintf( t('Warning: Database versions differ by %1$d updates.'), $v2 - $v1 ); notice($t); } if(array_key_exists('server_role',$data['compatibility']) && $data['compatibility']['server_role'] == 'basic') $moving = true; } - + if($moving) $seize = 1; - + // import channel - + $relocate = ((array_key_exists('relocate',$data)) ? $data['relocate'] : null); if(array_key_exists('channel',$data)) { - + $max_identities = account_service_class_fetch($account_id,'total_identities'); - + if($max_identities !== false) { $r = q("select channel_id from channel where channel_account_id = %d", intval($account_id) @@ -137,46 +146,40 @@ class Import extends \Zotlabs\Web\Controller { } $channel = import_channel($data['channel'], $account_id, $seize); - } else { $moving = false; $channel = \App::get_channel(); } - + if(! $channel) { - logger('mod_import: channel not found. ', print_r($channel,true)); + logger('Channel not found. ', print_r($channel,true)); notice( t('No channel. Import failed.') . EOL); return; } - - if(is_array($data['config'])) { import_config($channel,$data['config']); } - + logger('import step 2'); - - - if(array_key_exists('channel',$data)) { if($data['photo']) { require_once('include/photo/photo_driver.php'); import_channel_photo(base64url_decode($data['photo']['data']),$data['photo']['type'],$account_id,$channel['channel_id']); } - + if(is_array($data['profile'])) import_profiles($channel,$data['profile']); } - + logger('import step 3'); - + if(is_array($data['hubloc'])) { import_hublocs($channel,$data['hubloc'],$seize,$moving); } - + logger('import step 4'); // create new hubloc for the new channel at this site @@ -200,7 +203,7 @@ class Import extends \Zotlabs\Web\Controller { ); // reset the original primary hubloc if it is being seized - + if($seize) { $r = q("update hubloc set hubloc_primary = 0 where hubloc_primary = 1 and hubloc_hash = '%s' and hubloc_url != '%s' ", dbesc($channel['channel_hash']), @@ -210,20 +213,18 @@ class Import extends \Zotlabs\Web\Controller { } logger('import step 5'); - - - + + // import xchans and contact photos - + if(array_key_exists('channel',$data) && $seize) { - + // replace any existing xchan we may have on this site if we're seizing control - + $r = q("delete from xchan where xchan_hash = '%s'", dbesc($channel['channel_hash']) ); - $r = xchan_store_lowlevel( [ 'xchan_hash' => $channel['channel_hash'], @@ -242,23 +243,22 @@ class Import extends \Zotlabs\Web\Controller { 'xchan_photo_date' => datetime_convert(), 'xchan_name_date' => datetime_convert() ] - ); + ); } - + logger('import step 6'); - - + $xchans = $data['xchan']; if($xchans) { foreach($xchans as $xchan) { - + $hash = make_xchan_hash($xchan['xchan_guid'],$xchan['xchan_guid_sig']); if($xchan['xchan_network'] === 'zot' && $hash !== $xchan['xchan_hash']) { logger('forged xchan: ' . print_r($xchan,true)); continue; } - + if(! array_key_exists('xchan_hidden',$xchan)) { $xchan['xchan_hidden'] = (($xchan['xchan_flags'] & 0x0001) ? 1 : 0); $xchan['xchan_orphan'] = (($xchan['xchan_flags'] & 0x0002) ? 1 : 0); @@ -268,22 +268,22 @@ class Import extends \Zotlabs\Web\Controller { $xchan['xchan_pubforum'] = (($xchan['xchan_flags'] & 0x0020) ? 1 : 0); $xchan['xchan_deleted'] = (($xchan['xchan_flags'] & 0x1000) ? 1 : 0); } - + $r = q("select xchan_hash from xchan where xchan_hash = '%s' limit 1", dbesc($xchan['xchan_hash']) ); if($r) continue; - create_table_from_array('xchan',$xchan); - + create_table_from_array('xchan',$xchan); + require_once('include/photo/photo_driver.php'); $photos = import_xchan_photo($xchan['xchan_photo_l'],$xchan['xchan_hash']); if($photos[4]) $photodate = NULL_DATE; else $photodate = $xchan['xchan_photo_date']; - + $r = q("update xchan set xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s', xchan_photo_date = '%s' where xchan_hash = '%s'", dbesc($photos[0]), dbesc($photos[1]), @@ -292,27 +292,27 @@ class Import extends \Zotlabs\Web\Controller { dbesc($photodate), dbesc($xchan['xchan_hash']) ); - + } - logger('import step 7'); + logger('import step 7'); } - + $friends = 0; $feeds = 0; - + // import contacts $abooks = $data['abook']; if($abooks) { foreach($abooks as $abook) { $abook_copy = $abook; - + $abconfig = null; if(array_key_exists('abconfig',$abook) && is_array($abook['abconfig']) && count($abook['abconfig'])) $abconfig = $abook['abconfig']; - + unset($abook['abook_id']); unset($abook['abook_rating']); unset($abook['abook_rating_text']); @@ -332,7 +332,7 @@ class Import extends \Zotlabs\Web\Controller { $abook['abook_self'] = (($abook['abook_flags'] & 0x0080 ) ? 1 : 0); $abook['abook_feed'] = (($abook['abook_flags'] & 0x0100 ) ? 1 : 0); } - + if($abook['abook_self']) { $role = get_pconfig($channel['channel_id'],'system','permissions_role'); if(($role === 'forum') || ($abook['abook_my_perms'] & PERMS_W_TAGWALL)) { @@ -340,14 +340,14 @@ class Import extends \Zotlabs\Web\Controller { dbesc($abook['abook_xchan']) ); } - } + } else { if($max_friends !== false && $friends > $max_friends) continue; if($max_feeds !== false && intval($abook['abook_feed']) && ($feeds > $max_feeds)) continue; } - + create_table_from_array('abook',$abook); $friends ++; @@ -355,9 +355,9 @@ class Import extends \Zotlabs\Web\Controller { $feeds ++; translate_abook_perms_inbound($channel,$abook_copy); - + if($abconfig) { - // @fixme does not handle sync of del_abconfig + /// @FIXME does not handle sync of del_abconfig foreach($abconfig as $abc) { set_abconfig($channel['channel_id'],$abc['xchan'],$abc['cat'],$abc['k'],$abc['v']); } @@ -366,7 +366,7 @@ class Import extends \Zotlabs\Web\Controller { logger('import step 8'); } - + $groups = $data['group']; if($groups) { $saved = array(); @@ -388,10 +388,10 @@ class Import extends \Zotlabs\Web\Controller { foreach($r as $rr) { $saved[$rr['hash']]['new'] = $rr['id']; } - } + } } - - + + $group_members = $data['group_member']; if($group_members) { foreach($group_members as $group_member) { @@ -406,31 +406,31 @@ class Import extends \Zotlabs\Web\Controller { } logger('import step 9'); - + if(is_array($data['obj'])) import_objs($channel,$data['obj']); - + if(is_array($data['likes'])) import_likes($channel,$data['likes']); - + if(is_array($data['app'])) import_apps($channel,$data['app']); - + if(is_array($data['chatroom'])) import_chatrooms($channel,$data['chatroom']); - + if(is_array($data['conv'])) import_conv($channel,$data['conv']); - + if(is_array($data['mail'])) import_mail($channel,$data['mail']); - + if(is_array($data['event'])) import_events($channel,$data['event']); - + if(is_array($data['event_item'])) import_items($channel,$data['event_item'],false,$relocate); - + if(is_array($data['menu'])) import_menus($channel,$data['menu']); @@ -439,56 +439,61 @@ class Import extends \Zotlabs\Web\Controller { if(is_array($data['webpages'])) import_items($channel,$data['webpages'],false,$relocate); - + $addon = array('channel' => $channel,'data' => $data); call_hooks('import_channel',$addon); - + $saved_notification_flags = notifications_off($channel['channel_id']); - + if($import_posts && array_key_exists('item',$data) && $data['item']) import_items($channel,$data['item'],false,$relocate); - + notifications_on($channel['channel_id'],$saved_notification_flags); - - + + if(array_key_exists('item_id',$data) && $data['item_id']) import_item_ids($channel,$data['item_id']); - + // send out refresh requests // notify old server that it may no longer be primary. - + \Zotlabs\Daemon\Master::Summon(array('Notifier','location',$channel['channel_id'])); - + // This will indirectly perform a refresh_all *and* update the directory - + \Zotlabs\Daemon\Master::Summon(array('Directory', $channel['channel_id'])); - - + + notice( t('Import completed.') . EOL); - + change_channel($channel['channel_id']); - + goaway(z_root() . '/network' ); - } - - + + /** + * @brief Handle POST action on channel import page. + */ function post() { - $account_id = get_account_id(); if(! $account_id) return; - + $this->import_account($account_id); } - + + /** + * @brief Generate channel import page. + * + * @return string with parsed HTML. + */ function get() { - + if(! get_account_id()) { notice( t('You must be logged in to use this feature.')); return ''; } - + $o = replace_macros(get_markup_template('channel_import.tpl'),array( '$title' => t('Import Channel'), '$desc' => t('Use this form to import an existing channel from a different server/hub. You may retrieve the channel identity from the old server/hub via the network or provide an export file.'), @@ -501,14 +506,13 @@ class Import extends \Zotlabs\Web\Controller { '$label_import_primary' => t('Make this hub my primary location'), '$label_import_moving' => t('Move this channel (disable all previous locations)'), '$label_import_posts' => t('Import a few months of posts if possible (limited by available memory'), - '$pleasewait' => t('This process may take several minutes to complete. Please submit the form only once and leave this page open until finished.'), + '$pleasewait' => t('This process may take several minutes to complete. Please submit the form only once and leave this page open until finished.'), '$email' => '', '$pass' => '', '$submit' => t('Submit') )); - + return $o; - } - + } -- cgit v1.2.3 From 755b75161494ea9810ab0e38242cb1a318793ed3 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 15 Mar 2017 16:55:47 -0700 Subject: Comanche: allow widgets to be class based and stored appropriately in Zotlabs --- Zotlabs/Render/Comanche.php | 14 ++++++++++++++ Zotlabs/Widget/Notes.php | 23 +++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 Zotlabs/Widget/Notes.php (limited to 'Zotlabs') diff --git a/Zotlabs/Render/Comanche.php b/Zotlabs/Render/Comanche.php index 5826063fd..899fbd8aa 100644 --- a/Zotlabs/Render/Comanche.php +++ b/Zotlabs/Render/Comanche.php @@ -410,6 +410,20 @@ class Comanche { } } + $clsname = ucfirst($name); + $nsname = "Zotlabs\\Widget\\" . $clsname; + if(file_exists('Zotlabs/SiteWidget/' . $clsname . '.php')) + require_once('Zotlabs/SiteWidget/' . $clsname . '.php'); + elseif(file_exists('Zotlabs/Widget/' . $clsname . '.php')) + require_once('Zotlabs/Widget/' . $clsname . '.php'); + if(class_exists($nsname)) { + $x = new $nsname; + $f = 'widget'; + if(method_exists($x,$f)) { + return $x->$f($vars); + } + } + $func = 'widget_' . trim($name); if(! function_exists($func)) { diff --git a/Zotlabs/Widget/Notes.php b/Zotlabs/Widget/Notes.php new file mode 100644 index 000000000..5c83a550f --- /dev/null +++ b/Zotlabs/Widget/Notes.php @@ -0,0 +1,23 @@ + t('Notes'), + '$text' => $text, + '$save' => t('Save'), + )); + + return $o; + } +} -- cgit v1.2.3 From 242ef70a775a86050152c0aea9096ec1cd6d0312 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 15 Mar 2017 17:05:16 -0700 Subject: use absolute namespace --- Zotlabs/Render/Comanche.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Render/Comanche.php b/Zotlabs/Render/Comanche.php index 899fbd8aa..60a7b232c 100644 --- a/Zotlabs/Render/Comanche.php +++ b/Zotlabs/Render/Comanche.php @@ -411,7 +411,8 @@ class Comanche { } $clsname = ucfirst($name); - $nsname = "Zotlabs\\Widget\\" . $clsname; + $nsname = "\\Zotlabs\\Widget\\" . $clsname; + if(file_exists('Zotlabs/SiteWidget/' . $clsname . '.php')) require_once('Zotlabs/SiteWidget/' . $clsname . '.php'); elseif(file_exists('Zotlabs/Widget/' . $clsname . '.php')) -- cgit v1.2.3 From 477ed97c2fbfff903f9ebf0ffa7fba078eeac10f Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 15 Mar 2017 18:31:34 -0700 Subject: convert more widgets to classes --- Zotlabs/Widget/Collections.php | 51 +++++++++++++++++++++++++++++++++++++ Zotlabs/Widget/Profile | 13 ++++++++++ Zotlabs/Widget/Suggestions.php | 58 ++++++++++++++++++++++++++++++++++++++++++ Zotlabs/Widget/Tagcloud.php | 33 ++++++++++++++++++++++++ Zotlabs/Widget/Zcard.php | 11 ++++++++ 5 files changed, 166 insertions(+) create mode 100644 Zotlabs/Widget/Collections.php create mode 100644 Zotlabs/Widget/Profile create mode 100644 Zotlabs/Widget/Suggestions.php create mode 100644 Zotlabs/Widget/Tagcloud.php create mode 100644 Zotlabs/Widget/Zcard.php (limited to 'Zotlabs') diff --git a/Zotlabs/Widget/Collections.php b/Zotlabs/Widget/Collections.php new file mode 100644 index 000000000..d2b29679a --- /dev/null +++ b/Zotlabs/Widget/Collections.php @@ -0,0 +1,51 @@ + 2) ? mt_rand(0,count($r) - 2) : 0); + + for($x = $index; $x <= ($index+1); $x ++) { + $rr = $r[$x]; + if(! $rr['xchan_url']) + break; + + $connlnk = z_root() . '/follow/?url=' . $rr['xchan_addr']; + + $arr[] = array( + 'url' => chanlink_url($rr['xchan_url']), + 'profile' => $rr['xchan_url'], + 'name' => $rr['xchan_name'], + 'photo' => $rr['xchan_photo_m'], + 'ignlnk' => z_root() . '/directory?ignore=' . $rr['xchan_hash'], + 'conntxt' => t('Connect'), + 'connlnk' => $connlnk, + 'ignore' => t('Ignore/Hide') + ); + } + + $o = replace_macros(get_markup_template('suggest_widget.tpl'),array( + '$title' => t('Suggestions'), + '$more' => t('See more...'), + '$entries' => $arr + )); + + return $o; + } +} diff --git a/Zotlabs/Widget/Tagcloud.php b/Zotlabs/Widget/Tagcloud.php new file mode 100644 index 000000000..cf7a4932e --- /dev/null +++ b/Zotlabs/Widget/Tagcloud.php @@ -0,0 +1,33 @@ +

    ' . t('Categories') . '

    '; + foreach($r as $rv) { + $o .= '' . $rv[0] .' ' . "\r\n"; + } + $o .= '
    '; + } + return $o; + } +} diff --git a/Zotlabs/Widget/Zcard.php b/Zotlabs/Widget/Zcard.php new file mode 100644 index 000000000..12e53eaab --- /dev/null +++ b/Zotlabs/Widget/Zcard.php @@ -0,0 +1,11 @@ + 875)); + } +} -- cgit v1.2.3 From 17977effe775ef05a48a84da40da4b1f049b00d9 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 15 Mar 2017 18:48:27 -0700 Subject: more widgets --- Zotlabs/Widget/Follow.php | 37 +++++++++++++++++ Zotlabs/Widget/Savedsearch.php | 91 ++++++++++++++++++++++++++++++++++++++++++ Zotlabs/Widget/Sitesearch.php | 38 ++++++++++++++++++ 3 files changed, 166 insertions(+) create mode 100644 Zotlabs/Widget/Follow.php create mode 100644 Zotlabs/Widget/Savedsearch.php create mode 100644 Zotlabs/Widget/Sitesearch.php (limited to 'Zotlabs') diff --git a/Zotlabs/Widget/Follow.php b/Zotlabs/Widget/Follow.php new file mode 100644 index 000000000..c4aecc8e1 --- /dev/null +++ b/Zotlabs/Widget/Follow.php @@ -0,0 +1,37 @@ + t('Add New Connection'), + '$desc' => t('Enter channel address'), + '$hint' => t('Examples: bob@example.com, https://example.com/barbara'), + '$follow' => t('Connect'), + '$abook_usage_message' => $abook_usage_message + )); + } +} + diff --git a/Zotlabs/Widget/Savedsearch.php b/Zotlabs/Widget/Savedsearch.php new file mode 100644 index 000000000..378c27139 --- /dev/null +++ b/Zotlabs/Widget/Savedsearch.php @@ -0,0 +1,91 @@ + $rr['tid'], + 'term' => $rr['term'], + 'dellink' => z_root() . '/' . $srchurl . (($hasq || $hasamp) ? '' : '?f=') . '&searchremove=1&search=' . urlencode($rr['term']), + 'srchlink' => z_root() . '/' . $srchurl . (($hasq || $hasamp) ? '' : '?f=') . '&search=' . urlencode($rr['term']), + 'displayterm' => htmlspecialchars($rr['term'], ENT_COMPAT,'UTF-8'), + 'encodedterm' => urlencode($rr['term']), + 'delete' => t('Remove term'), + 'selected' => ($search==$rr['term']), + ); + } + } + + $tpl = get_markup_template("saved_searches.tpl"); + $o = replace_macros($tpl, array( + '$title' => t('Saved Searches'), + '$add' => t('add'), + '$searchbox' => searchbox($search, 'netsearch-box', $srchurl . (($hasq) ? '' : '?f='), true), + '$saved' => $saved, + )); + + return $o; + } +} diff --git a/Zotlabs/Widget/Sitesearch.php b/Zotlabs/Widget/Sitesearch.php new file mode 100644 index 000000000..b3a25d76a --- /dev/null +++ b/Zotlabs/Widget/Sitesearch.php @@ -0,0 +1,38 @@ + t('Search'), + '$searchbox' => searchbox($search, 'netsearch-box', $srchurl . (($hasq) ? '' : '?f='), false), + '$saved' => $saved, + )); + + return $o; + } +} -- cgit v1.2.3 From 74f58818d628a30297f48720b73c094b215f593b Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 15 Mar 2017 19:13:16 -0700 Subject: filename issue --- Zotlabs/Widget/Profile | 13 ------------- Zotlabs/Widget/Profile.php | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 Zotlabs/Widget/Profile create mode 100644 Zotlabs/Widget/Profile.php (limited to 'Zotlabs') diff --git a/Zotlabs/Widget/Profile b/Zotlabs/Widget/Profile deleted file mode 100644 index bffd910b6..000000000 --- a/Zotlabs/Widget/Profile +++ /dev/null @@ -1,13 +0,0 @@ - Date: Wed, 15 Mar 2017 19:30:57 -0700 Subject: more widgets --- Zotlabs/Widget/Archive.php | 55 ++++++++++++++++++++++++++++++++++++++++++ Zotlabs/Widget/Filer.php | 35 +++++++++++++++++++++++++++ Zotlabs/Widget/Fullprofile.php | 16 ++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 Zotlabs/Widget/Archive.php create mode 100644 Zotlabs/Widget/Filer.php create mode 100644 Zotlabs/Widget/Fullprofile.php (limited to 'Zotlabs') diff --git a/Zotlabs/Widget/Archive.php b/Zotlabs/Widget/Archive.php new file mode 100644 index 000000000..c151ca563 --- /dev/null +++ b/Zotlabs/Widget/Archive.php @@ -0,0 +1,55 @@ + t('Archives'), + '$size' => $visible_years, + '$cutoff_year' => $cutoff_year, + '$cutoff' => $cutoff, + '$url' => $url, + '$style' => $style, + '$showend' => $showend, + '$dates' => $ret + )); + return $o; + } +} + diff --git a/Zotlabs/Widget/Filer.php b/Zotlabs/Widget/Filer.php new file mode 100644 index 000000000..cb9a0becf --- /dev/null +++ b/Zotlabs/Widget/Filer.php @@ -0,0 +1,35 @@ + $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : '')); + + return replace_macros(get_markup_template('fileas_widget.tpl'),array( + '$title' => t('Saved Folders'), + '$desc' => '', + '$sel_all' => (($selected == '') ? 'selected' : ''), + '$all' => t('Everything'), + '$terms' => $terms, + '$base' => z_root() . '/' . \App::$cmd + )); + } +} diff --git a/Zotlabs/Widget/Fullprofile.php b/Zotlabs/Widget/Fullprofile.php new file mode 100644 index 000000000..d7340ef40 --- /dev/null +++ b/Zotlabs/Widget/Fullprofile.php @@ -0,0 +1,16 @@ + Date: Wed, 15 Mar 2017 20:11:28 -0700 Subject: more widget migrations --- Zotlabs/Widget/Appcategories.php | 49 ++++++++++++++++++++++++++++++++++++++++ Zotlabs/Widget/Appcloud.php | 13 +++++++++++ Zotlabs/Widget/Categories.php | 22 ++++++++++++++++++ Zotlabs/Widget/Shortprofile.php | 18 +++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 Zotlabs/Widget/Appcategories.php create mode 100644 Zotlabs/Widget/Appcloud.php create mode 100644 Zotlabs/Widget/Categories.php create mode 100644 Zotlabs/Widget/Shortprofile.php (limited to 'Zotlabs') diff --git a/Zotlabs/Widget/Appcategories.php b/Zotlabs/Widget/Appcategories.php new file mode 100644 index 000000000..490ec1abc --- /dev/null +++ b/Zotlabs/Widget/Appcategories.php @@ -0,0 +1,49 @@ + $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : '')); + + return replace_macros(get_markup_template('categories_widget.tpl'),array( + '$title' => t('Categories'), + '$desc' => '', + '$sel_all' => (($selected == '') ? 'selected' : ''), + '$all' => t('Everything'), + '$terms' => $terms, + '$base' => $srchurl, + + )); + } + } +} diff --git a/Zotlabs/Widget/Appcloud.php b/Zotlabs/Widget/Appcloud.php new file mode 100644 index 000000000..2a4671eee --- /dev/null +++ b/Zotlabs/Widget/Appcloud.php @@ -0,0 +1,13 @@ + Date: Wed, 15 Mar 2017 20:56:12 -0700 Subject: widgets cont. --- Zotlabs/Widget/Affinity.php | 60 +++++++++++++++++ Zotlabs/Widget/Catcloud_wall.php | 19 ++++++ Zotlabs/Widget/Conversations.php | 74 +++++++++++++++++++++ Zotlabs/Widget/Design_tools.php | 21 ++++++ Zotlabs/Widget/Eventstools.php | 19 ++++++ Zotlabs/Widget/Mailmenu.php | 36 ++++++++++ Zotlabs/Widget/Photo_albums.php | 25 +++++++ Zotlabs/Widget/Settings_menu.php | 137 +++++++++++++++++++++++++++++++++++++++ Zotlabs/Widget/Tagcloud_wall.php | 20 ++++++ 9 files changed, 411 insertions(+) create mode 100644 Zotlabs/Widget/Affinity.php create mode 100644 Zotlabs/Widget/Catcloud_wall.php create mode 100644 Zotlabs/Widget/Conversations.php create mode 100644 Zotlabs/Widget/Design_tools.php create mode 100644 Zotlabs/Widget/Eventstools.php create mode 100644 Zotlabs/Widget/Mailmenu.php create mode 100644 Zotlabs/Widget/Photo_albums.php create mode 100644 Zotlabs/Widget/Settings_menu.php create mode 100644 Zotlabs/Widget/Tagcloud_wall.php (limited to 'Zotlabs') diff --git a/Zotlabs/Widget/Affinity.php b/Zotlabs/Widget/Affinity.php new file mode 100644 index 000000000..439ba1f33 --- /dev/null +++ b/Zotlabs/Widget/Affinity.php @@ -0,0 +1,60 @@ + $cmin . ',' . $cmax, + '$refresh' => t('Refresh'), + '$labels' => $label_str, + )); + + $arr = array('html' => $x); + call_hooks('main_slider',$arr); + return $arr['html']; + } + return ''; + } +} + \ No newline at end of file diff --git a/Zotlabs/Widget/Catcloud_wall.php b/Zotlabs/Widget/Catcloud_wall.php new file mode 100644 index 000000000..3795987cc --- /dev/null +++ b/Zotlabs/Widget/Catcloud_wall.php @@ -0,0 +1,19 @@ + 1) { + + switch(argv(1)) { + case 'combined': + $mailbox = 'combined'; + $header = t('Conversations'); + break; + case 'inbox': + $mailbox = 'inbox'; + $header = t('Received Messages'); + break; + case 'outbox': + $mailbox = 'outbox'; + $header = t('Sent Messages'); + break; + default: + $mailbox = 'combined'; + $header = t('Conversations'); + break; + } + + require_once('include/message.php'); + + // private_messages_list() can do other more complicated stuff, for now keep it simple + $r = private_messages_list(local_channel(), $mailbox, App::$pager['start'], App::$pager['itemspage']); + + if(! $r) { + info( t('No messages.') . EOL); + return $o; + } + + $messages = array(); + + foreach($r as $rr) { + + $messages[] = array( + 'mailbox' => $mailbox, + 'id' => $rr['id'], + 'from_name' => $rr['from']['xchan_name'], + 'from_url' => chanlink_hash($rr['from_xchan']), + 'from_photo' => $rr['from']['xchan_photo_s'], + 'to_name' => $rr['to']['xchan_name'], + 'to_url' => chanlink_hash($rr['to_xchan']), + 'to_photo' => $rr['to']['xchan_photo_s'], + 'subject' => (($rr['seen']) ? $rr['title'] : '' . $rr['title'] . ''), + 'delete' => t('Delete conversation'), + 'body' => $rr['body'], + 'date' => datetime_convert('UTC',date_default_timezone_get(),$rr['created'], 'c'), + 'seen' => $rr['seen'], + 'selected' => ((argv(2)) ? (argv(2) == $rr['id']) : ($r[0]['id'] == $rr['id'])) + ); + } + + $tpl = get_markup_template('mail_head.tpl'); + $o .= replace_macros($tpl, array( + '$header' => $header, + '$messages' => $messages + )); + + } + return $o; + } +} \ No newline at end of file diff --git a/Zotlabs/Widget/Design_tools.php b/Zotlabs/Widget/Design_tools.php new file mode 100644 index 000000000..8ab6a235d --- /dev/null +++ b/Zotlabs/Widget/Design_tools.php @@ -0,0 +1,21 @@ + t('Events Tools'), + '$export' => t('Export Calendar'), + '$import' => t('Import Calendar'), + '$submit' => t('Submit') + )); + } +} diff --git a/Zotlabs/Widget/Mailmenu.php b/Zotlabs/Widget/Mailmenu.php new file mode 100644 index 000000000..512f7d9c0 --- /dev/null +++ b/Zotlabs/Widget/Mailmenu.php @@ -0,0 +1,36 @@ + t('Private Mail Menu'), + '$combined' => array( + 'label' => t('Combined View'), + 'url' => z_root() . '/mail/combined', + 'sel' => (argv(1) == 'combined'), + ), + '$inbox' => array( + 'label' => t('Inbox'), + 'url' => z_root() . '/mail/inbox', + 'sel' => (argv(1) == 'inbox'), + ), + '$outbox' => array( + 'label' => t('Outbox'), + 'url' => z_root() . '/mail/outbox', + 'sel' => (argv(1) == 'outbox'), + ), + '$new' => array( + 'label' => t('New Message'), + 'url' => z_root() . '/mail/new', + 'sel'=> (argv(1) == 'new'), + ) + )); + } +} diff --git a/Zotlabs/Widget/Photo_albums.php b/Zotlabs/Widget/Photo_albums.php new file mode 100644 index 000000000..2a746e492 --- /dev/null +++ b/Zotlabs/Widget/Photo_albums.php @@ -0,0 +1,25 @@ + 1) ? true : false); + + $tabs = array( + array( + 'label' => t('Account settings'), + 'url' => z_root().'/settings/account', + 'selected' => ((argv(1) === 'account') ? 'active' : ''), + ), + + array( + 'label' => t('Channel settings'), + 'url' => z_root().'/settings/channel', + 'selected' => ((argv(1) === 'channel') ? 'active' : ''), + ), + + ); + + if(get_account_techlevel() > 0 && get_features()) { + $tabs[] = array( + 'label' => t('Additional features'), + 'url' => z_root().'/settings/features', + 'selected' => ((argv(1) === 'features') ? 'active' : ''), + ); + } + + $tabs[] = array( + 'label' => t('Feature/Addon settings'), + 'url' => z_root().'/settings/featured', + 'selected' => ((argv(1) === 'featured') ? 'active' : ''), + ); + + $tabs[] = array( + 'label' => t('Display settings'), + 'url' => z_root().'/settings/display', + 'selected' => ((argv(1) === 'display') ? 'active' : ''), + ); + + if($hublocs) { + $tabs[] = array( + 'label' => t('Manage locations'), + 'url' => z_root() . '/locs', + 'selected' => ((argv(1) === 'locs') ? 'active' : ''), + ); + } + + $tabs[] = array( + 'label' => t('Export channel'), + 'url' => z_root() . '/uexport', + 'selected' => '' + ); + + $tabs[] = array( + 'label' => t('Connected apps'), + 'url' => z_root() . '/settings/oauth', + 'selected' => ((argv(1) === 'oauth') ? 'active' : ''), + ); + + if(get_account_techlevel() > 2) { + $tabs[] = array( + 'label' => t('Guest Access Tokens'), + 'url' => z_root() . '/settings/tokens', + 'selected' => ((argv(1) === 'tokens') ? 'active' : ''), + ); + } + + if(feature_enabled(local_channel(),'permcats')) { + $tabs[] = array( + 'label' => t('Permission Groups'), + 'url' => z_root() . '/settings/permcats', + 'selected' => ((argv(1) === 'permcats') ? 'active' : ''), + ); + } + + + if($role === false || $role === 'custom') { + $tabs[] = array( + 'label' => t('Connection Default Permissions'), + 'url' => z_root() . '/connedit/' . $abook_self_id, + 'selected' => '' + ); + } + + if(feature_enabled(local_channel(),'premium_channel')) { + $tabs[] = array( + 'label' => t('Premium Channel Settings'), + 'url' => z_root() . '/connect/' . $channel['channel_address'], + 'selected' => '' + ); + } + + if(feature_enabled(local_channel(),'channel_sources')) { + $tabs[] = array( + 'label' => t('Channel Sources'), + 'url' => z_root() . '/sources', + 'selected' => '' + ); + } + + $tabtpl = get_markup_template("generic_links_widget.tpl"); + return replace_macros($tabtpl, array( + '$title' => t('Settings'), + '$class' => 'settings-widget', + '$items' => $tabs, + )); + } + +} \ No newline at end of file diff --git a/Zotlabs/Widget/Tagcloud_wall.php b/Zotlabs/Widget/Tagcloud_wall.php new file mode 100644 index 000000000..7cff6ce09 --- /dev/null +++ b/Zotlabs/Widget/Tagcloud_wall.php @@ -0,0 +1,20 @@ + Date: Wed, 15 Mar 2017 21:26:28 -0700 Subject: widgets cont. --- Zotlabs/Widget/Admin.php | 68 ++++++++++++++++++++++++++++++++++++ Zotlabs/Widget/Chatroom_list.php | 24 +++++++++++++ Zotlabs/Widget/Chatroom_members.php | 15 ++++++++ Zotlabs/Widget/Menu_preview.php | 16 +++++++++ Zotlabs/Widget/Tasklist.php | 30 ++++++++++++++++ Zotlabs/Widget/Vcard.php | 12 +++++++ Zotlabs/Widget/Wiki_list.php | 23 ++++++++++++ Zotlabs/Widget/Wiki_page_history.php | 27 ++++++++++++++ Zotlabs/Widget/Wiki_pages.php | 59 +++++++++++++++++++++++++++++++ 9 files changed, 274 insertions(+) create mode 100644 Zotlabs/Widget/Admin.php create mode 100644 Zotlabs/Widget/Chatroom_list.php create mode 100644 Zotlabs/Widget/Chatroom_members.php create mode 100644 Zotlabs/Widget/Menu_preview.php create mode 100644 Zotlabs/Widget/Tasklist.php create mode 100644 Zotlabs/Widget/Vcard.php create mode 100644 Zotlabs/Widget/Wiki_list.php create mode 100644 Zotlabs/Widget/Wiki_page_history.php create mode 100644 Zotlabs/Widget/Wiki_pages.php (limited to 'Zotlabs') diff --git a/Zotlabs/Widget/Admin.php b/Zotlabs/Widget/Admin.php new file mode 100644 index 000000000..a761eebe3 --- /dev/null +++ b/Zotlabs/Widget/Admin.php @@ -0,0 +1,68 @@ + array(z_root() . '/admin/site/', t('Site'), 'site'), + 'accounts' => array(z_root() . '/admin/accounts/', t('Accounts'), 'accounts', 'pending-update', t('Member registrations waiting for confirmation')), + 'channels' => array(z_root() . '/admin/channels/', t('Channels'), 'channels'), + 'security' => array(z_root() . '/admin/security/', t('Security'), 'security'), + 'features' => array(z_root() . '/admin/features/', t('Features'), 'features'), + 'plugins' => array(z_root() . '/admin/plugins/', t('Plugins'), 'plugins'), + 'themes' => array(z_root() . '/admin/themes/', t('Themes'), 'themes'), + 'queue' => array(z_root() . '/admin/queue', t('Inspect queue'), 'queue'), + 'profs' => array(z_root() . '/admin/profs', t('Profile Fields'), 'profs'), + 'dbsync' => array(z_root() . '/admin/dbsync/', t('DB updates'), 'dbsync') + ]; + + /* get plugins admin page */ + + $r = q("SELECT * FROM addon WHERE plugin_admin = 1"); + + $plugins = array(); + if($r) { + foreach ($r as $h){ + $plugin = $h['aname']; + $plugins[] = array(z_root() . '/admin/plugins/' . $plugin, $plugin, 'plugin'); + // temp plugins with admin + \App::$plugins_admin[] = $plugin; + } + } + + $logs = array(z_root() . '/admin/logs/', t('Logs'), 'logs'); + + $arr = array('links' => $aside,'plugins' => $plugins,'logs' => $logs); + call_hooks('admin_aside',$arr); + + $o .= replace_macros(get_markup_template('admin_aside.tpl'), array( + '$admin' => $aside, + '$admtxt' => t('Admin'), + '$plugadmtxt' => t('Plugin Features'), + '$plugins' => $plugins, + '$logtxt' => t('Logs'), + '$logs' => $logs, + '$h_pending' => t('Member registrations waiting for confirmation'), + '$admurl'=> z_root() . '/admin/' + )); + + return $o; + + } +} + diff --git a/Zotlabs/Widget/Chatroom_list.php b/Zotlabs/Widget/Chatroom_list.php new file mode 100644 index 000000000..e2aad0e05 --- /dev/null +++ b/Zotlabs/Widget/Chatroom_list.php @@ -0,0 +1,24 @@ + t('Chatrooms'), + '$baseurl' => z_root(), + '$nickname' => \App::$profile['channel_address'], + '$items' => $r, + '$overview' => t('Overview') + )); + } + } +} diff --git a/Zotlabs/Widget/Chatroom_members.php b/Zotlabs/Widget/Chatroom_members.php new file mode 100644 index 000000000..8ed77fb3c --- /dev/null +++ b/Zotlabs/Widget/Chatroom_members.php @@ -0,0 +1,15 @@ + t('Chat Members') + )); + } + +} diff --git a/Zotlabs/Widget/Menu_preview.php b/Zotlabs/Widget/Menu_preview.php new file mode 100644 index 000000000..51218f6cf --- /dev/null +++ b/Zotlabs/Widget/Menu_preview.php @@ -0,0 +1,16 @@ +var tasksShowAll = 0; $(document).ready(function() { tasksFetch(); $("#tasklist-new-form").submit(function(event) { event.preventDefault(); $.post( "tasks/new", $("#tasklist-new-form").serialize(), function(data) { tasksFetch(); $("#tasklist-new-summary").val(""); } ); return false; } )});'; + $o .= ''; + + $o .= '
    ' . '

    ' . t('Tasks') . '

    '; + $o .= '
    '; + $o .= '
    '; + return $o; + + } +} + diff --git a/Zotlabs/Widget/Vcard.php b/Zotlabs/Widget/Vcard.php new file mode 100644 index 000000000..cab05dfdd --- /dev/null +++ b/Zotlabs/Widget/Vcard.php @@ -0,0 +1,12 @@ + t('Wiki List'), + '$channel' => $channel['channel_address'], + '$wikis' => $wikis['wikis'] + )); + } + return ''; + } + +} diff --git a/Zotlabs/Widget/Wiki_page_history.php b/Zotlabs/Widget/Wiki_page_history.php new file mode 100644 index 000000000..dcec9a037 --- /dev/null +++ b/Zotlabs/Widget/Wiki_page_history.php @@ -0,0 +1,27 @@ + \App::$profile_uid, + 'observer_hash' => get_observer_hash(), + 'resource_id' => $resource_id, + 'pageUrlName' => $pageUrlName + ]); + + return replace_macros(get_markup_template('nwiki_page_history.tpl'), array( + '$pageHistory' => $pageHistory['history'], + '$permsWrite' => $arr['permsWrite'], + '$name_lbl' => t('Name'), + '$msg_label' => t('Message','wiki_history') + )); + + } +} diff --git a/Zotlabs/Widget/Wiki_pages.php b/Zotlabs/Widget/Wiki_pages.php new file mode 100644 index 000000000..bad451475 --- /dev/null +++ b/Zotlabs/Widget/Wiki_pages.php @@ -0,0 +1,59 @@ + $hide, + '$resource_id' => $arr['resource_id'], + '$not_refresh' => $not_refresh, + '$header' => t('Wiki Pages'), + '$channel' => $channelname, + '$wikiname' => $wikiname, + '$pages' => $pages, + '$canadd' => $can_create, + '$candel' => $can_delete, + '$addnew' => t('Add new page'), + '$pageName' => array('pageName', t('Page name')), + )); + } +} + + -- cgit v1.2.3 From cd57483ed9069a26b52ae8d7d74fdc537da89946 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 29 Mar 2017 11:59:20 +0200 Subject: namespace error --- Zotlabs/Widget/Conversations.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Widget/Conversations.php b/Zotlabs/Widget/Conversations.php index fa59ce20c..31fcb6c58 100644 --- a/Zotlabs/Widget/Conversations.php +++ b/Zotlabs/Widget/Conversations.php @@ -33,7 +33,7 @@ class Conversations { require_once('include/message.php'); // private_messages_list() can do other more complicated stuff, for now keep it simple - $r = private_messages_list(local_channel(), $mailbox, App::$pager['start'], App::$pager['itemspage']); + $r = private_messages_list(local_channel(), $mailbox, \App::$pager['start'], App::$pager['itemspage']); if(! $r) { info( t('No messages.') . EOL); @@ -71,4 +71,4 @@ class Conversations { } return $o; } -} \ No newline at end of file +} -- cgit v1.2.3 From 0bad26e116499d9b656c28f64c81275df4bbecb6 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 16 Mar 2017 17:11:48 -0700 Subject: the rest of the standard widgets converted --- Zotlabs/Widget/Activity.php | 61 +++++++++++++++++ Zotlabs/Widget/Album.php | 106 +++++++++++++++++++++++++++++ Zotlabs/Widget/Bookmarkedchats.php | 28 ++++++++ Zotlabs/Widget/Categories.php | 1 + Zotlabs/Widget/Clock.php | 63 +++++++++++++++++ Zotlabs/Widget/Cover_photo.php | 59 ++++++++++++++++ Zotlabs/Widget/Dirsort.php | 11 +++ Zotlabs/Widget/Dirtags.php | 13 ++++ Zotlabs/Widget/Filer.php | 1 + Zotlabs/Widget/Findpeople.php | 12 ++++ Zotlabs/Widget/Forums.php | 97 ++++++++++++++++++++++++++ Zotlabs/Widget/Helpindex.php | 45 ++++++++++++ Zotlabs/Widget/Item.php | 54 +++++++++++++++ Zotlabs/Widget/Photo.php | 55 +++++++++++++++ Zotlabs/Widget/Photo_rand.php | 66 ++++++++++++++++++ Zotlabs/Widget/Pubsites.php | 16 +++++ Zotlabs/Widget/Random_block.php | 46 +++++++++++++ Zotlabs/Widget/Rating.php | 67 ++++++++++++++++++ Zotlabs/Widget/Suggestedchats.php | 37 ++++++++++ Zotlabs/Widget/Website_portation_tools.php | 22 ++++++ 20 files changed, 860 insertions(+) create mode 100644 Zotlabs/Widget/Activity.php create mode 100644 Zotlabs/Widget/Album.php create mode 100644 Zotlabs/Widget/Bookmarkedchats.php create mode 100644 Zotlabs/Widget/Clock.php create mode 100644 Zotlabs/Widget/Cover_photo.php create mode 100644 Zotlabs/Widget/Dirsort.php create mode 100644 Zotlabs/Widget/Dirtags.php create mode 100644 Zotlabs/Widget/Findpeople.php create mode 100644 Zotlabs/Widget/Forums.php create mode 100644 Zotlabs/Widget/Helpindex.php create mode 100644 Zotlabs/Widget/Item.php create mode 100644 Zotlabs/Widget/Photo.php create mode 100644 Zotlabs/Widget/Photo_rand.php create mode 100644 Zotlabs/Widget/Pubsites.php create mode 100644 Zotlabs/Widget/Random_block.php create mode 100644 Zotlabs/Widget/Rating.php create mode 100644 Zotlabs/Widget/Suggestedchats.php create mode 100644 Zotlabs/Widget/Website_portation_tools.php (limited to 'Zotlabs') diff --git a/Zotlabs/Widget/Activity.php b/Zotlabs/Widget/Activity.php new file mode 100644 index 000000000..72a27bdf1 --- /dev/null +++ b/Zotlabs/Widget/Activity.php @@ -0,0 +1,61 @@ + $v) { + $arr[] = [ 'author_xchan' => $k, 'total' => $v ]; + } + usort($arr,'total_sort'); + xchan_query($arr); + } + + $x = [ 'entries' => $arr ]; + call_hooks('activity_widget',$x); + $arr = $x['entries']; + + if($arr) { + $o .= '
    '; + $o .= '

    ' . t('Activity','widget') . '

    '; + } + return $o; + } + +} + diff --git a/Zotlabs/Widget/Album.php b/Zotlabs/Widget/Album.php new file mode 100644 index 000000000..f359e6d0f --- /dev/null +++ b/Zotlabs/Widget/Album.php @@ -0,0 +1,106 @@ + $rr['id'], + 'twist' => ' ' . $twist . rand(2,4), + 'link' => $imagelink, + 'title' => t('View Photo'), + 'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . $rr['imgscale'] . '.' .$ext, + 'alt' => $imgalt_e, + 'desc'=> $desc_e, + 'ext' => $ext, + 'hash'=> $rr['resource_id'], + 'unknown' => t('Unknown') + ); + } + } + + + $tpl = get_markup_template('photo_album.tpl'); + $o .= replace_macros($tpl, array( + '$photos' => $photos, + '$album' => (($title) ? $title : $album), + '$album_id' => rand(), + '$album_edit' => array(t('Edit Album'), $album_edit), + '$can_post' => false, + '$upload' => array(t('Upload'), z_root() . '/photos/' . \App::$profile['channel_address'] . '/upload/' . bin2hex($album)), + '$order' => false, + '$upload_form' => $upload_form, + '$usage' => $usage_message + )); + + return $o; + } +} + diff --git a/Zotlabs/Widget/Bookmarkedchats.php b/Zotlabs/Widget/Bookmarkedchats.php new file mode 100644 index 000000000..d64bbdb4b --- /dev/null +++ b/Zotlabs/Widget/Bookmarkedchats.php @@ -0,0 +1,28 @@ + t('Bookmarked Chatrooms'), + '$rooms' => $r + )); + } +} diff --git a/Zotlabs/Widget/Categories.php b/Zotlabs/Widget/Categories.php index 82fffccc8..d1dcfda93 100644 --- a/Zotlabs/Widget/Categories.php +++ b/Zotlabs/Widget/Categories.php @@ -2,6 +2,7 @@ namespace Zotlabs\Widget; +require_once('include/contact_widgets.php'); class Categories { diff --git a/Zotlabs/Widget/Clock.php b/Zotlabs/Widget/Clock.php new file mode 100644 index 000000000..b63b5f748 --- /dev/null +++ b/Zotlabs/Widget/Clock.php @@ -0,0 +1,63 @@ + +

    + + +EOT; + + return $o; + } +} + diff --git a/Zotlabs/Widget/Cover_photo.php b/Zotlabs/Widget/Cover_photo.php new file mode 100644 index 000000000..d2eb1be92 --- /dev/null +++ b/Zotlabs/Widget/Cover_photo.php @@ -0,0 +1,59 @@ +') !== false) + $style = ''; + + if(array_key_exists('title', $arr) && isset($arr['title'])) + $title = $arr['title']; + else + $title = $channel['channel_name']; + + if(array_key_exists('subtitle', $arr) && isset($arr['subtitle'])) + $subtitle = $arr['subtitle']; + else + $subtitle = str_replace('@','@',$channel['xchan_addr']); + + $c = get_cover_photo($channel_id,'html'); + + if($c) { + $photo_html = (($style) ? str_replace('alt=',' style="' . $style . '" alt=',$c) : $c); + + $o = replace_macros(get_markup_template('cover_photo_widget.tpl'),array( + '$photo_html' => $photo_html, + '$title' => $title, + '$subtitle' => $subtitle, + '$hovertitle' => t('Click to show more'), + )); + } + return $o; + } +} diff --git a/Zotlabs/Widget/Dirsort.php b/Zotlabs/Widget/Dirsort.php new file mode 100644 index 000000000..e75a00e50 --- /dev/null +++ b/Zotlabs/Widget/Dirsort.php @@ -0,0 +1,11 @@ +'; + $o .= '

    ' . t('Forums') . '

    '; + } + return $o; + + } +} diff --git a/Zotlabs/Widget/Helpindex.php b/Zotlabs/Widget/Helpindex.php new file mode 100644 index 000000000..62cecce1f --- /dev/null +++ b/Zotlabs/Widget/Helpindex.php @@ -0,0 +1,45 @@ +'; + + $level_0 = get_help_content('sitetoc'); + if(! $level_0) + $level_0 = get_help_content('toc'); + + $level_0 = preg_replace('/\/','