From 59bd90b967e9938c294a3a2738e8d177fa497782 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 5 Oct 2018 13:31:54 +0200 Subject: Add 'Channel Export' in Apps list --- Zotlabs/Lib/Apps.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 8db4e000f..826b2db29 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -354,7 +354,8 @@ class Apps { 'Permission Categories' => t('Permission Categories'), 'Premium Channel' => t('Premium Channel'), 'Public Stream' => t('Public Stream'), - 'My Chatrooms' => t('My Chatrooms') + 'My Chatrooms' => t('My Chatrooms'), + 'Channel Export' => t('Channel Export') ); if(array_key_exists('name',$arr)) { -- cgit v1.2.3 From c2c891723fc0e56f0c373ca1043cdb548f2ed8ab Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 6 Oct 2018 14:48:12 +0200 Subject: bookmark app --- Zotlabs/Lib/Apps.php | 2 +- Zotlabs/Lib/ThreadItem.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 826b2db29..d7cea6b7c 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -306,7 +306,7 @@ class Apps { 'Cards' => t('Cards'), 'Admin' => t('Site Admin'), 'Report Bug' => t('Report Bug'), - 'View Bookmarks' => t('View Bookmarks'), + 'Bookmarks' => t('Bookmarks'), 'Chatrooms' => t('Chatrooms'), 'Connections' => t('Connections'), 'Remote Diagnostics' => t('Remote Diagnostics'), diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 48018f66c..78714c2c4 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -2,6 +2,8 @@ namespace Zotlabs\Lib; +use Zotlabs\Lib\Apps; + require_once('include/text.php'); /** @@ -272,7 +274,7 @@ class ThreadItem { } $has_bookmarks = false; - if(is_array($item['term'])) { + if(Apps::system_app_installed(local_channel(), 'Bookmarks') && is_array($item['term'])) { foreach($item['term'] as $t) { if(($t['ttype'] == TERM_BOOKMARK)) $has_bookmarks = true; -- cgit v1.2.3 From 9850d1842087d1842d9360ed5fd3bdea74e575c9 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 6 Oct 2018 15:00:28 +0200 Subject: gallery is not a core app --- Zotlabs/Lib/Apps.php | 1 - 1 file changed, 1 deletion(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index d7cea6b7c..3c9616375 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -345,7 +345,6 @@ class Apps { 'CalDAV' => t('CalDAV'), 'CardDAV' => t('CardDAV'), 'Channel Sources' => t('Channel Sources'), - 'Gallery' => t('Gallery'), 'Guest Access' => t('Guest Access'), 'Notes' => t('Notes'), 'OAuth Apps Manager' => t('OAuth Apps Manager'), -- cgit v1.2.3 From 453ce4df3bddab898f49102f74ffb072693e2dbd Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 6 Oct 2018 15:12:13 +0200 Subject: admin should not be an app imho - we can not install/delete admin abilities. Remove suggest channels from base apps. --- Zotlabs/Lib/Apps.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 3c9616375..19cc78d17 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -59,7 +59,6 @@ class Apps { static public function get_base_apps() { return get_config('system','base_apps',[ 'Connections', - 'Suggest Channels', 'Grid', 'Settings', 'Files', @@ -75,8 +74,6 @@ class Apps { ]); } - - static public function import_system_apps() { if(! local_channel()) return; -- cgit v1.2.3 From 96277372d55a58349e318e694f4dab3a00fb2f13 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 6 Oct 2018 16:40:30 +0200 Subject: rename grid to network (for consistency) and activity to stream (as seen in osada) because it makes much more sense. --- Zotlabs/Lib/Apps.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 19cc78d17..5117816bf 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -59,7 +59,7 @@ class Apps { static public function get_base_apps() { return get_config('system','base_apps',[ 'Connections', - 'Grid', + 'Network', 'Settings', 'Files', 'Channel Home', @@ -310,7 +310,7 @@ class Apps { 'Suggest Channels' => t('Suggest Channels'), 'Login' => t('Login'), 'Channel Manager' => t('Channel Manager'), - 'Grid' => t('Activity'), + 'Network' => t('Stream'), 'Settings' => t('Settings'), 'Files' => t('Files'), 'Webpages' => t('Webpages'), -- cgit v1.2.3 From 93a310582f044d35f0a3583671053595fefdbedb Mon Sep 17 00:00:00 2001 From: "M.Dent" Date: Sun, 7 Oct 2018 19:08:47 -0400 Subject: Implement custom escaping --- Zotlabs/Lib/NativeWiki.php | 36 +++++++++++++++++++++++++++++++++--- Zotlabs/Lib/NativeWikiPage.php | 12 ++++++++---- 2 files changed, 41 insertions(+), 7 deletions(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/NativeWiki.php b/Zotlabs/Lib/NativeWiki.php index 6f916216e..4309d3f6e 100644 --- a/Zotlabs/Lib/NativeWiki.php +++ b/Zotlabs/Lib/NativeWiki.php @@ -26,7 +26,8 @@ class NativeWiki { $w['rawName'] = get_iconfig($w, 'wiki', 'rawName'); $w['htmlName'] = escape_tags($w['rawName']); - $w['urlName'] = urlencode(urlencode($w['rawName'])); + //$w['urlName'] = urlencode(urlencode($w['rawName'])); + $w['urlName'] = self::name_encode($w['rawName']); $w['mimeType'] = get_iconfig($w, 'wiki', 'mimeType'); $w['typelock'] = get_iconfig($w, 'wiki', 'typelock'); $w['lockstate'] = (($w['allow_cid'] || $w['allow_gid'] || $w['deny_cid'] || $w['deny_gid']) ? 'lock' : 'unlock'); @@ -233,7 +234,8 @@ class NativeWiki { 'wiki' => $w, 'rawName' => $rawName, 'htmlName' => escape_tags($rawName), - 'urlName' => urlencode(urlencode($rawName)), + //'urlName' => urlencode(urlencode($rawName)), + 'urlName' => self::name_encode($rawName), 'mimeType' => $mimeType, 'typelock' => $typelock ); @@ -249,7 +251,8 @@ class NativeWiki { WHERE resource_type = '%s' AND iconfig.v = '%s' AND uid = %d AND item_deleted = 0 $sql_extra limit 1", dbesc(NWIKI_ITEM_RESOURCE_TYPE), - dbesc(urldecode($urlName)), + //dbesc(urldecode($urlName)), + dbesc($urlName), intval($uid) ); @@ -286,4 +289,31 @@ class NativeWiki { return array('read' => true, 'write' => $write, 'success' => true); } } + + public static function name_encode ($string) { + + $encoding = mb_internal_encoding(); + mb_internal_encoding("UTF-8"); + $ret = mb_ereg_replace_callback ('[^A-Za-z0-9\-\_\.\~]',function ($char) { + $charhex = unpack('H*',$char[0]); + $ret = '('.$charhex[1].')'; + return $ret; + } + ,$string); + mb_internal_encoding($encoding); + return $ret; + } + + public static function name_decode ($string) { + + $encoding = mb_internal_encoding(); + mb_internal_encoding("UTF-8"); + $ret = mb_ereg_replace_callback ('(\(([0-9a-f]+)\))',function ($chars) { + return pack('H*',$chars[2]); + } + ,$string); + mb_internal_encoding($encoding); + return $ret; + } + } diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php index d4875bbaf..d0f522ec1 100644 --- a/Zotlabs/Lib/NativeWikiPage.php +++ b/Zotlabs/Lib/NativeWikiPage.php @@ -44,7 +44,8 @@ class NativeWikiPage { $pages[] = [ 'resource_id' => $resource_id, 'title' => escape_tags($title), - 'url' => str_replace('%2F','/',urlencode(str_replace('%2F','/',urlencode($title)))), + //'url' => str_replace('%2F','/',urlencode(str_replace('%2F','/',urlencode($title)))), + 'url' => Zlib\NativeWiki::name_encode($title), 'link_id' => 'id_' . substr($resource_id, 0, 10) . '_' . $page_item['id'] ]; } @@ -98,7 +99,8 @@ class NativeWikiPage { $page = [ 'rawName' => $name, 'htmlName' => escape_tags($name), - 'urlName' => urlencode($name), + //'urlName' => urlencode($name), + Zlib\NativeWiki::name_encode($name) ]; @@ -154,7 +156,8 @@ class NativeWikiPage { $page = [ 'rawName' => $pageNewName, 'htmlName' => escape_tags($pageNewName), - 'urlName' => urlencode(escape_tags($pageNewName)) + //'urlName' => urlencode(escape_tags($pageNewName)) + Zlib\NativeWiki::name_encode($pageNewName) ]; return [ 'success' => true, 'page' => $page ]; @@ -527,7 +530,8 @@ class NativeWikiPage { $pages = $pageURLs = array(); foreach ($match[1] as $m) { // TODO: Why do we need to double urlencode for this to work? - $pageURLs[] = urlencode(urlencode(escape_tags($m))); + //$pageURLs[] = urlencode(urlencode(escape_tags($m))); + $pageURLs[] = Zlib\NativeWiki::name_encode(escape_tags($m)); $pages[] = $m; } $idx = 0; -- cgit v1.2.3 From 709665846e66f093109730691b31d9e094d02088 Mon Sep 17 00:00:00 2001 From: "M.Dent" Date: Mon, 8 Oct 2018 13:22:39 -0400 Subject: Rework Wiki encoding scheme. --- Zotlabs/Lib/NativeWiki.php | 1 + Zotlabs/Lib/NativeWikiPage.php | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/NativeWiki.php b/Zotlabs/Lib/NativeWiki.php index 4309d3f6e..65f40748c 100644 --- a/Zotlabs/Lib/NativeWiki.php +++ b/Zotlabs/Lib/NativeWiki.php @@ -292,6 +292,7 @@ class NativeWiki { public static function name_encode ($string) { + $string = html_entity_decode($string); $encoding = mb_internal_encoding(); mb_internal_encoding("UTF-8"); $ret = mb_ereg_replace_callback ('[^A-Za-z0-9\-\_\.\~]',function ($char) { diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php index d0f522ec1..ebdcb4740 100644 --- a/Zotlabs/Lib/NativeWikiPage.php +++ b/Zotlabs/Lib/NativeWikiPage.php @@ -100,7 +100,7 @@ class NativeWikiPage { 'rawName' => $name, 'htmlName' => escape_tags($name), //'urlName' => urlencode($name), - Zlib\NativeWiki::name_encode($name) + 'urlName' => Zlib\NativeWiki::name_encode($name) ]; @@ -368,7 +368,6 @@ class NativeWikiPage { unset($item['id']); unset($item['author']); - $item['parent'] = 0; $item['body'] = $content; $item['author_xchan'] = $observer_hash; -- cgit v1.2.3