From 66bf55710ea4fc13c3b2c35cce2c5e095b695388 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Mon, 10 Sep 2018 15:13:28 +0200 Subject: Update network.php --- include/network.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/network.php b/include/network.php index d4f4f27c6..5ae02deff 100644 --- a/include/network.php +++ b/include/network.php @@ -157,7 +157,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { if($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307 || $http_code == 308) { $matches = array(); - preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches); + preg_match('/(Location:|URI:)(.*?)\n/i', $header, $matches); $newurl = trim(array_pop($matches)); if(strpos($newurl,'/') === 0) $newurl = $url . $newurl; -- cgit v1.2.3 From 2651eae663869e78aa0166bd33ac80a44b26b5ea Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 12 Sep 2018 11:08:53 +0200 Subject: mpre feature to app transition --- include/features.php | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'include') diff --git a/include/features.php b/include/features.php index 7e2c9a3ac..b7e1878c3 100644 --- a/include/features.php +++ b/include/features.php @@ -81,24 +81,6 @@ function get_features($filtered = true, $level = (-1)) { get_config('feature_lock','profile_export'), feature_level('profile_export',3), ], - - [ - 'webpages', - t('Web Pages'), - t('Provide managed web pages on your channel'), - false, - get_config('feature_lock','webpages'), - feature_level('webpages',3), - ], - - [ - 'wiki', - t('Wiki'), - t('Provide a wiki for your channel'), - false, - get_config('feature_lock','wiki'), - feature_level('wiki',2), - ], /* [ 'hide_rating', @@ -118,15 +100,6 @@ function get_features($filtered = true, $level = (-1)) { feature_level('private_notes',1), ], - [ - 'articles', - t('Articles'), - t('Create interactive articles'), - false, - get_config('feature_lock','articles'), - feature_level('articles',1), - ], - [ 'nav_channel_select', t('Navigation Channel Select'), -- cgit v1.2.3 From 184928204a264b231814b46ef294ef185dc0cdae Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 12 Sep 2018 11:14:49 +0200 Subject: Fix PHP Warning: DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity --- include/markdown.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/markdown.php b/include/markdown.php index e5f5b9369..0d810764f 100644 --- a/include/markdown.php +++ b/include/markdown.php @@ -295,6 +295,8 @@ function bb_to_markdown($Text, $options = []) { */ function html2markdown($html,$options = []) { $markdown = ''; + + $html = htmlspecialchars($html); $environment = Environment::createDefaultEnvironment($options); $environment->addConverter(new TableConverter()); -- cgit v1.2.3 From 57e3ee47ee02002239bab1cde5b68f741e6f0c08 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 12 Sep 2018 20:52:55 +0200 Subject: more feature to app transition --- include/nav.php | 56 ++++++++++++++++++++++++++------------------------------ 1 file changed, 26 insertions(+), 30 deletions(-) (limited to 'include') diff --git a/include/nav.php b/include/nav.php index 56fe9b901..7520fd782 100644 --- a/include/nav.php +++ b/include/nav.php @@ -1,11 +1,11 @@ $item]; - Zlib\Apps::translate_system_apps($item); + Apps::translate_system_apps($item); App::$nav_sel['name'] = $item['name']; } - - function channel_apps($is_owner = false, $nickname = null) { // Don't provide any channel apps if we're running as the sys channel @@ -420,7 +418,7 @@ function channel_apps($is_owner = false, $nickname = null) { if ($p['chat'] && feature_enabled($uid,'ajaxchat')) { - $has_chats = ZLib\Chatroom::list_count($uid); + $has_chats = Chatroom::list_count($uid); if ($has_chats) { $tabs[] = [ 'label' => t('Chatrooms'), @@ -445,7 +443,7 @@ function channel_apps($is_owner = false, $nickname = null) { ]; } - if($p['view_pages'] && feature_enabled($uid,'cards')) { + if($p['view_pages'] && Apps::system_app_installed($uid, 'Cards')) { $tabs[] = [ 'label' => t('Cards'), 'url' => z_root() . '/cards/' . $nickname , @@ -456,7 +454,7 @@ function channel_apps($is_owner = false, $nickname = null) { ]; } - if($p['view_pages'] && feature_enabled($uid,'articles')) { + if($p['view_pages'] && Apps::system_app_installed($uid, 'Articles')) { $tabs[] = [ 'label' => t('Articles'), 'url' => z_root() . '/articles/' . $nickname , @@ -468,7 +466,7 @@ function channel_apps($is_owner = false, $nickname = null) { } - if($has_webpages && feature_enabled($uid,'webpages')) { + if($has_webpages && Apps::system_app_installed($uid, 'Webpages')) { $tabs[] = [ 'label' => t('Webpages'), 'url' => z_root() . '/page/' . $nickname . '/home', @@ -480,17 +478,15 @@ function channel_apps($is_owner = false, $nickname = null) { } - if ($p['view_wiki']) { - if(feature_enabled($uid,'wiki') && (get_account_techlevel($account_id) > 3)) { - $tabs[] = [ - 'label' => t('Wikis'), - 'url' => z_root() . '/wiki/' . $nickname, - 'sel' => ((argv(0) == 'wiki') ? 'active' : ''), - 'title' => t('Wiki'), - 'id' => 'wiki-tab', - 'icon' => 'pencil-square-o' - ]; - } + if ($p['view_wiki'] && Apps::system_app_installed($uid, 'Wiki')) { + $tabs[] = [ + 'label' => t('Wikis'), + 'url' => z_root() . '/wiki/' . $nickname, + 'sel' => ((argv(0) == 'wiki') ? 'active' : ''), + 'title' => t('Wiki'), + 'id' => 'wiki-tab', + 'icon' => 'pencil-square-o' + ]; } $arr = array('is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs); -- cgit v1.2.3 From a1d5ce3716d09b7ccd81e252309ca9fd5e841b26 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 13 Sep 2018 10:59:37 +0200 Subject: remove profile_tabs() which has been deprecated and replaced by channel_apps() --- include/conversation.php | 200 ----------------------------------------------- include/nav.php | 2 +- 2 files changed, 1 insertion(+), 201 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 4997bc2b7..1df46bd16 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1757,206 +1757,6 @@ function network_tabs() { return replace_macros($tpl, array('$tabs' => $arr['tabs'])); } -/** - * @brief - * - * @param App $a - * @param boolean $is_owner default false - * @param string $nickname default null - * @return void|string - */ -function profile_tabs($a, $is_owner = false, $nickname = null){ - - // Don't provide any profile tabs if we're running as the sys channel - - if (App::$is_sys) - return; - - if (get_pconfig($uid, 'system', 'noprofiletabs')) - return; - - $channel = App::get_channel(); - - if (is_null($nickname)) - $nickname = $channel['channel_address']; - - - $uid = ((App::$profile['profile_uid']) ? App::$profile['profile_uid'] : local_channel()); - $account_id = ((App::$profile['profile_uid']) ? App::$profile['channel_account_id'] : App::$channel['channel_account_id']); - - if ($uid == local_channel()) - return; - - if($uid == local_channel()) { - $cal_link = ''; - } - else { - $cal_link = '/cal/' . $nickname; - } - - require_once('include/security.php'); - $sql_options = item_permissions_sql($uid); - - $r = q("select item.* from item left join iconfig on item.id = iconfig.iid - where item.uid = %d and iconfig.cat = 'system' and iconfig.v = '%s' - and item.item_delayed = 0 and item.item_deleted = 0 - and ( iconfig.k = 'WEBPAGE' and item_type = %d ) - $sql_options limit 1", - intval($uid), - dbesc('home'), - intval(ITEM_TYPE_WEBPAGE) - ); - - $has_webpages = (($r) ? true : false); - - if (x($_GET, 'tab')) - $tab = notags(trim($_GET['tab'])); - - $url = z_root() . '/channel/' . $nickname; - $pr = z_root() . '/profile/' . $nickname; - - $tabs = array( - array( - 'label' => t('Channel'), - 'url' => $url, - 'sel' => ((argv(0) == 'channel') ? 'active' : ''), - 'title' => t('Status Messages and Posts'), - 'id' => 'status-tab', - 'icon' => 'home' - ), - ); - - $p = get_all_perms($uid,get_observer_hash()); - - if ($p['view_profile']) { - $tabs[] = array( - 'label' => t('About'), - 'url' => $pr, - 'sel' => ((argv(0) == 'profile') ? 'active' : ''), - 'title' => t('Profile Details'), - 'id' => 'profile-tab', - 'icon' => 'user' - ); - } - if ($p['view_storage']) { - $tabs[] = array( - 'label' => t('Photos'), - 'url' => z_root() . '/photos/' . $nickname, - 'sel' => ((argv(0) == 'photos') ? 'active' : ''), - 'title' => t('Photo Albums'), - 'id' => 'photo-tab', - 'icon' => 'photo' - ); - $tabs[] = array( - 'label' => t('Files'), - 'url' => z_root() . '/cloud/' . $nickname, - 'sel' => ((argv(0) == 'cloud' || argv(0) == 'sharedwithme') ? 'active' : ''), - 'title' => t('Files and Storage'), - 'id' => 'files-tab', - 'icon' => 'folder-open' - ); - } - - if($p['view_stream'] && $cal_link) { - $tabs[] = array( - 'label' => t('Events'), - 'url' => z_root() . $cal_link, - 'sel' => ((argv(0) == 'cal' || argv(0) == 'events') ? 'active' : ''), - 'title' => t('Events'), - 'id' => 'event-tab', - 'icon' => 'calendar' - ); - } - - - if ($p['chat'] && feature_enabled($uid,'ajaxchat')) { - $has_chats = Zotlabs\Lib\Chatroom::list_count($uid); - if ($has_chats) { - $tabs[] = array( - 'label' => t('Chatrooms'), - 'url' => z_root() . '/chat/' . $nickname, - 'sel' => ((argv(0) == 'chat') ? 'active' : '' ), - 'title' => t('Chatrooms'), - 'id' => 'chat-tab', - 'icon' => 'comments-o' - ); - } - } - - require_once('include/menu.php'); - $has_bookmarks = menu_list_count(local_channel(),'',MENU_BOOKMARK) + menu_list_count(local_channel(),'',MENU_SYSTEM|MENU_BOOKMARK); - - if($is_owner && $has_bookmarks) { - $tabs[] = array( - 'label' => t('Bookmarks'), - 'url' => z_root() . '/bookmarks', - 'sel' => ((argv(0) == 'bookmarks') ? 'active' : ''), - 'title' => t('Saved Bookmarks'), - 'id' => 'bookmarks-tab', - 'icon' => 'bookmark' - ); - } - - if(feature_enabled($uid,'cards')) { - $tabs[] = array( - 'label' => t('Cards'), - 'url' => z_root() . '/cards/' . $nickname, - 'sel' => ((argv(0) == 'cards') ? 'active' : ''), - 'title' => t('View Cards'), - 'id' => 'cards-tab', - 'icon' => 'list' - ); - } - - if(feature_enabled($uid,'articles')) { - $tabs[] = array( - 'label' => t('articles'), - 'url' => z_root() . '/articles/' . $nickname, - 'sel' => ((argv(0) == 'articles') ? 'active' : ''), - 'title' => t('View Articles'), - 'id' => 'articles-tab', - 'icon' => 'file-text-o' - ); - } - - if($has_webpages && feature_enabled($uid,'webpages')) { - $tabs[] = array( - 'label' => t('Webpages'), - 'url' => z_root() . '/page/' . $nickname . '/home', - 'sel' => ((argv(0) == 'webpages') ? 'active' : ''), - 'title' => t('View Webpages'), - 'id' => 'webpages-tab', - 'icon' => 'newspaper-o' - ); - } - - - if ($p['view_wiki']) { - if(feature_enabled($uid,'wiki') && (get_account_techlevel($account_id) > 3)) { - $tabs[] = array( - 'label' => t('Wikis'), - 'url' => z_root() . '/wiki/' . $nickname, - 'sel' => ((argv(0) == 'wiki') ? 'active' : ''), - 'title' => t('Wiki'), - 'id' => 'wiki-tab', - 'icon' => 'pencil-square-o' - ); - } - } - - $arr = array('is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs); - call_hooks('profile_tabs', $arr); - - $tpl = get_markup_template('profile_tabs.tpl'); - - return replace_macros($tpl, array( - '$tabs' => $arr['tabs'], - '$name' => App::$profile['channel_name'], - '$thumb' => App::$profile['thumb'] - )); -} - - function get_responses($conv_responses,$response_verbs,$ob,$item) { $ret = array(); diff --git a/include/nav.php b/include/nav.php index 7520fd782..15060a033 100644 --- a/include/nav.php +++ b/include/nav.php @@ -490,7 +490,7 @@ function channel_apps($is_owner = false, $nickname = null) { } $arr = array('is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs); - call_hooks('profile_tabs', $arr); + call_hooks('channel_apps', $arr); return replace_macros(get_markup_template('profile_tabs.tpl'), -- cgit v1.2.3 From 56f88f2e30ef75fa7e41cbcbbc6344abc6b7d37d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 13 Sep 2018 11:32:43 +0200 Subject: move chat from feature to apps --- include/features.php | 10 ---------- include/nav.php | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) (limited to 'include') diff --git a/include/features.php b/include/features.php index b7e1878c3..5479be122 100644 --- a/include/features.php +++ b/include/features.php @@ -118,16 +118,6 @@ function get_features($filtered = true, $level = (-1)) { feature_level('photo_location',2), ], - [ - 'ajaxchat', - t('Access Controlled Chatrooms'), - t('Provide chatrooms and chat services with access control.'), - true, - get_config('feature_lock','ajaxchat'), - feature_level('ajaxchat',1), - ], - - [ 'smart_birthdays', t('Smart Birthdays'), diff --git a/include/nav.php b/include/nav.php index 15060a033..9afba7945 100644 --- a/include/nav.php +++ b/include/nav.php @@ -417,7 +417,7 @@ function channel_apps($is_owner = false, $nickname = null) { } - if ($p['chat'] && feature_enabled($uid,'ajaxchat')) { + if ($p['chat'] && Apps::system_app_installed($uid,'Chatrooms')) { $has_chats = Chatroom::list_count($uid); if ($has_chats) { $tabs[] = [ -- cgit v1.2.3 From 869534fafa543a76e58c32d5aa8f674217682162 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 13 Sep 2018 11:53:59 +0200 Subject: remove network_tabs() which has been deprecated and replaced by activity_{order, filters} widgets --- include/conversation.php | 113 ----------------------------------------------- 1 file changed, 113 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 1df46bd16..28a339479 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1644,119 +1644,6 @@ function prepare_page($item) { )); } - -function network_tabs() { - - $no_active=''; - $starred_active = ''; - $new_active = ''; - $all_active = ''; - $search_active = ''; - $conv_active = ''; - $spam_active = ''; - $postord_active = ''; - - if(x($_GET,'new')) { - $new_active = 'active'; - } - - if(x($_GET,'search')) { - $search_active = 'active'; - } - - if(x($_GET,'star')) { - $starred_active = 'active'; - } - - if(x($_GET,'conv')) { - $conv_active = 'active'; - } - - if(x($_GET,'spam')) { - $spam_active = 'active'; - } - - if (($new_active == '') - && ($starred_active == '') - && ($conv_active == '') - && ($search_active == '') - && ($spam_active == '')) { - $no_active = 'active'; - } - - if ($no_active=='active' && x($_GET,'order')) { - switch($_GET['order']){ - case 'post': $postord_active = 'active'; $no_active=''; break; - case 'comment' : $all_active = 'active'; $no_active=''; break; - } - } - - if ($no_active=='active') $all_active='active'; - - $cmd = App::$cmd; - - // tabs - $tabs = array(); - - $tabs[] = array( - 'label' => t('Commented Order'), - 'url'=>z_root() . '/' . $cmd . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), - 'sel'=>$all_active, - 'title'=> t('Sort by Comment Date'), - ); - - $tabs[] = array( - 'label' => t('Posted Order'), - 'url'=>z_root() . '/' . $cmd . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), - 'sel'=>$postord_active, - 'title' => t('Sort by Post Date'), - ); - - if(feature_enabled(local_channel(),'personal_tab')) { - $tabs[] = array( - 'label' => t('Personal'), - 'url' => z_root() . '/' . $cmd . '?f=' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . '&conv=1', - 'sel' => $conv_active, - 'title' => t('Posts that mention or involve you'), - ); - } - - if(feature_enabled(local_channel(),'new_tab')) { - $tabs[] = array( - 'label' => t('New'), - 'url' => z_root() . '/' . $cmd . '?f=' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . '&new=1' . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), - 'sel' => $new_active, - 'title' => t('Activity Stream - by date'), - ); - } - - if(feature_enabled(local_channel(),'star_posts')) { - $tabs[] = array( - 'label' => t('Starred'), - 'url'=>z_root() . '/' . $cmd . '/?f=' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . '&star=1', - 'sel'=>$starred_active, - 'title' => t('Favourite Posts'), - ); - } - // Not yet implemented - - if(feature_enabled(local_channel(),'spam_filter')) { - $tabs[] = array( - 'label' => t('Spam'), - 'url'=> z_root() . '/network?f=&spam=1', - 'sel'=> $spam_active, - 'title' => t('Posts flagged as SPAM'), - ); - } - - $arr = array('tabs' => $tabs); - call_hooks('network_tabs', $arr); - - $tpl = get_markup_template('common_tabs.tpl'); - - return replace_macros($tpl, array('$tabs' => $arr['tabs'])); -} - function get_responses($conv_responses,$response_verbs,$ob,$item) { $ret = array(); -- cgit v1.2.3