diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/account.php | 4 | ||||
-rw-r--r-- | include/attach.php | 4 | ||||
-rw-r--r-- | include/bbcode.php | 2 | ||||
-rw-r--r-- | include/channel.php | 9 | ||||
-rw-r--r-- | include/conversation.php | 7 | ||||
-rw-r--r-- | include/features.php | 6 | ||||
-rw-r--r-- | include/nav.php | 20 | ||||
-rw-r--r-- | include/network.php | 13 | ||||
-rwxr-xr-x | include/oembed.php | 4 | ||||
-rw-r--r-- | include/text.php | 34 | ||||
-rw-r--r-- | include/widgets.php | 4 | ||||
-rw-r--r-- | include/wiki.php | 39 | ||||
-rw-r--r-- | include/zot.php | 6 |
13 files changed, 114 insertions, 38 deletions
diff --git a/include/account.php b/include/account.php index 142ad1bea..5c44f13ca 100644 --- a/include/account.php +++ b/include/account.php @@ -407,7 +407,7 @@ function account_allow($hash) { pop_lang(); - if(get_config('system','auto_channel_create') || UNO) + if(get_config('system','auto_channel_create') || get_config('system','server_role') === 'basic') auto_channel_create($register[0]['uid']); if ($res) { @@ -511,7 +511,7 @@ function account_approve($hash) { - if(get_config('system','auto_channel_create') || UNO) + if(get_config('system','auto_channel_create') || get_config('system','server_role') === 'basic') auto_channel_create($register[0]['uid']); else { $_SESSION['login_return_url'] = 'new_channel'; diff --git a/include/attach.php b/include/attach.php index f3fb12293..e15f08bd4 100644 --- a/include/attach.php +++ b/include/attach.php @@ -578,7 +578,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { $pathname = filepath_macro($album); } } - else { + if(! $pathname) { $pathname = filepath_macro($upload_path); } @@ -1977,4 +1977,4 @@ function get_filename_by_cloudname($cloudname, $channel, $storepath) { } } return null; -}
\ No newline at end of file +} diff --git a/include/bbcode.php b/include/bbcode.php index 7f7be4300..db3a1011b 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -667,7 +667,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) } // Remove bookmarks from UNO - if (UNO) + if (get_config('system','server_role') === 'basic') $Text = str_replace('<span class="bookmark-identifier">#^</span>', '', $Text); // Perform MAIL Search diff --git a/include/channel.php b/include/channel.php index c07cd14e2..62c35e3ff 100644 --- a/include/channel.php +++ b/include/channel.php @@ -423,14 +423,6 @@ function create_identity($arr) { set_pconfig($ret['channel']['channel_id'],'system','attach_path','%Y-%m'); } - // UNO: channel defaults, incl addons (addons specific pconfig will only work after the relevant addon is enabled by the admin). It's located here, so members can modify these defaults after the channel is created. - if(UNO) { - //diaspora protocol addon - set_pconfig($ret['channel']['channel_id'],'system','diaspora_allowed', '1'); - set_pconfig($ret['channel']['channel_id'],'system','diaspora_public_comments', '1'); - set_pconfig($ret['channel']['channel_id'],'system','prevent_tag_hijacking', '0'); - } - // auto-follow any of the hub's pre-configured channel choices. // Only do this if it's the first channel for this account; // otherwise it could get annoying. Don't make this list too big @@ -1077,6 +1069,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa $diaspora = array( 'podloc' => z_root(), 'guid' => $profile['channel_guid'] . str_replace('.','',App::get_hostname()), + 'pubkey' => pemtorsa($profile['channel_pubkey']), 'searchable' => (($block) ? 'false' : 'true'), 'nickname' => $profile['channel_address'], 'fullname' => $profile['channel_name'], diff --git a/include/conversation.php b/include/conversation.php index 1efca37f3..b53498d20 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -802,6 +802,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $ continue; } + $item['pagedrop'] = $page_dropping; if($item['id'] == $item['parent']) { @@ -1253,6 +1254,10 @@ function status_editor($a, $x, $popup = false) { '$visitor' => $x['visitor'], '$lockstate' => $x['lockstate'], '$acl' => $x['acl'], + '$allow_cid' => acl2json($x['permissions']['allow_cid']), + '$allow_gid' => acl2json($x['permissions']['allow_gid']), + '$deny_cid' => acl2json($x['permissions']['deny_cid']), + '$deny_gid' => acl2json($x['permissions']['deny_gid']), '$mimeselect' => $mimeselect, '$layoutselect' => $layoutselect, '$showacl' => ((array_key_exists('showacl', $x)) ? $x['showacl'] : true), @@ -1705,7 +1710,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null){ ); } - if(feature_enabled($uid,'wiki') && (! UNO)) { + if(feature_enabled($uid,'wiki') && (get_config('system','server_role') !== 'basic')) { $tabs[] = array( 'label' => t('Wiki'), 'url' => z_root() . '/wiki/' . $nickname, diff --git a/include/features.php b/include/features.php index 2d71aa9be..041c028c6 100644 --- a/include/features.php +++ b/include/features.php @@ -38,7 +38,9 @@ function get_feature_default($feature) { function get_features($filtered = true) { - if(UNO && $filtered) + $server_role = get_config('system','server_role'); + + if($server_role === 'basic' && $filtered) return array(); $arr = array( @@ -52,7 +54,7 @@ function get_features($filtered = true) { array('advanced_profiles', t('Advanced Profiles'), t('Additional profile sections and selections'),false,get_config('feature_lock','advanced_profiles')), array('profile_export', t('Profile Import/Export'), t('Save and load profile details across sites/channels'),false,get_config('feature_lock','profile_export')), array('webpages', t('Web Pages'), t('Provide managed web pages on your channel'),false,get_config('feature_lock','webpages')), - array('wiki', t('Wiki'), t('Provide a wiki for your channel'),((UNO) ? false : true),get_config('feature_lock','wiki')), + array('wiki', t('Wiki'), t('Provide a wiki for your channel'),(($server_role === 'basic') ? false : true),get_config('feature_lock','wiki')), array('hide_rating', t('Hide Rating'), t('Hide the rating buttons on your channel and profile pages. Note: People can still rate you somewhere else.'),false,get_config('feature_lock','hide_rating')), array('private_notes', t('Private Notes'), t('Enables a tool to store notes and reminders (note: not encrypted)'),false,get_config('feature_lock','private_notes')), array('nav_channel_select', t('Navigation Channel Select'), t('Change channels directly from within the navigation dropdown menu'),false,get_config('feature_lock','nav_channel_select')), diff --git a/include/nav.php b/include/nav.php index 1fb0e98dc..025da71b3 100644 --- a/include/nav.php +++ b/include/nav.php @@ -61,13 +61,15 @@ EOT; '$banner' => $banner )); + $server_role = get_config('system','server_role'); + $basic = (($server_role === 'basic') ? true : false); // nav links: array of array('href', 'text', 'extra css classes', 'title') $nav = Array(); /** * Display login or logout - */ + */ $nav['usermenu']=array(); $userinfo = null; @@ -76,7 +78,7 @@ EOT; if(local_channel()) { - if($chans && count($chans) > 1 && feature_enabled(local_channel(),'nav_channel_select') && (! UNO)) + if($chans && count($chans) > 1 && feature_enabled(local_channel(),'nav_channel_select') && (! $basic)) $nav['channels'] = $chans; $nav['logout'] = Array('logout',t('Logout'), "", t('End this session'),'logout_nav_btn'); @@ -84,7 +86,7 @@ EOT; // user menu $nav['usermenu'][] = Array('channel/' . $channel['channel_address'], t('Home'), "", t('Your posts and conversations'),'channel_nav_btn'); $nav['usermenu'][] = Array('profile/' . $channel['channel_address'], t('View Profile'), "", t('Your profile page'),'profile_nav_btn'); - if(feature_enabled(local_channel(),'multi_profiles') && (! UNO)) + if(feature_enabled(local_channel(),'multi_profiles') && (! $basic)) $nav['usermenu'][] = Array('profiles', t('Edit Profiles'),"", t('Manage/Edit profiles'),'profiles_nav_btn'); else $nav['usermenu'][] = Array('profiles/' . $prof[0]['id'], t('Edit Profile'),"", t('Edit your profile'),'profiles_nav_btn'); @@ -92,19 +94,19 @@ EOT; $nav['usermenu'][] = Array('photos/' . $channel['channel_address'], t('Photos'), "", t('Your photos'),'photos_nav_btn'); $nav['usermenu'][] = Array('cloud/' . $channel['channel_address'],t('Files'),"",t('Your files'),'cloud_nav_btn'); - if((! UNO) && feature_enabled(local_channel(),'ajaxchat')) + if((! $basic) && feature_enabled(local_channel(),'ajaxchat')) $nav['usermenu'][] = Array('chat/' . $channel['channel_address'], t('Chat'),"",t('Your chatrooms'),'chat_nav_btn'); require_once('include/menu.php'); $has_bookmarks = menu_list_count(local_channel(),'',MENU_BOOKMARK) + menu_list_count(local_channel(),'',MENU_SYSTEM|MENU_BOOKMARK); - if(($has_bookmarks) && (! UNO)) { + if(($has_bookmarks) && (! $basic)) { $nav['usermenu'][] = Array('bookmarks', t('Bookmarks'), "", t('Your bookmarks'),'bookmarks_nav_btn'); } - if(feature_enabled($channel['channel_id'],'webpages') && (! UNO)) + if(feature_enabled($channel['channel_id'],'webpages') && (! $basic)) $nav['usermenu'][] = Array('webpages/' . $channel['channel_address'],t('Webpages'),"",t('Your webpages'),'webpages_nav_btn'); - if(feature_enabled($channel['channel_id'],'wiki') && (! UNO)) + if(feature_enabled($channel['channel_id'],'wiki') && (! $basic)) $nav['usermenu'][] = Array('wiki/' . $channel['channel_address'],t('Wiki'),"",t('Your wiki'),'wiki_nav_btn'); } else { @@ -161,7 +163,7 @@ EOT; $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'), 'help_nav_btn', $context_help, $enable_context_help); } - if(! UNO) + if(! $basic) $nav['apps'] = array('apps', t('Apps'), "", t('Applications, utilities, links, games'),'apps_nav_btn'); $nav['search'] = array('search', t('Search'), "", t('Search site @name, #tag, ?docs, content')); @@ -204,7 +206,7 @@ EOT; $nav['all_events']['all']=array('events', t('See all events'), "", ""); $nav['all_events']['mark'] = array('', t('Mark all events seen'), '',''); - if(! UNO) + if(! $basic) $nav['manage'] = array('manage', t('Channel Manager'), "", t('Manage Your Channels'),'manage_nav_btn'); $nav['settings'] = array('settings', t('Settings'),"", t('Account/Channel Settings'),'settings_nav_btn'); diff --git a/include/network.php b/include/network.php index 47863b680..fe001b362 100644 --- a/include/network.php +++ b/include/network.php @@ -1343,13 +1343,18 @@ function discover_by_webbie($webbie) { $fullname = $vcard['fn']; if($vcard['photo'] && (strpos($vcard['photo'],'http') !== 0)) $vcard['photo'] = $diaspora_base . '/' . $vcard['photo']; - if(($vcard['key']) && (! $pubkey)) - $pubkey = $vcard['key']; + if(($vcard['public_key']) && (! $pubkey)) { + $diaspora_key = $vcard['public_key']; + if(strstr($diaspora_key,'RSA ')) + $pubkey = rsatopem($diaspora_key); + else + $pubkey = $diaspora_key; + } if(! $avatar) $avatar = $vcard['photo']; if($diaspora) { - if(($vcard['guid']) && (! $diaspora_guid)) - $diaspora_guid = $vcard['guid']; + if(($vcard['uid']) && (! $diaspora_guid)) + $diaspora_guid = $vcard['uid']; if(($vcard['url']) && (! $diaspora_base)) $diaspora_base = $vcard['url']; diff --git a/include/oembed.php b/include/oembed.php index fe3a3c33c..5c6f6be79 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -216,8 +216,8 @@ function oembed_fetch_url($embedurl){ logger('oembed html was purified. original: ' . $orig . ' purified: ' . $j->html, LOGGER_DEBUG, LOG_INFO); } - $orig_len = trim(mb_strlen($orig)); - $new_len = trim(mb_strlen($j->html)); + $orig_len = mb_strlen(trim($orig)); + $new_len = mb_strlen(trim($j->html)); if(! $new_len) $j->type = 'error'; elseif($orig_len) { diff --git a/include/text.php b/include/text.php index d508f8ab3..ac210b336 100644 --- a/include/text.php +++ b/include/text.php @@ -1179,6 +1179,7 @@ function smilies($s, $sample = false) { $s = preg_replace_callback('{<(pre|code)>.*?</\1>}ism', 'smile_shield', $s); $s = preg_replace_callback('/<[a-z]+ .*?>/ism', 'smile_shield', $s); + $params = list_smilies(); $params['string'] = $s; @@ -1192,6 +1193,7 @@ function smilies($s, $sample = false) { $s = str_replace($params['texts'],$params['icons'],$params['string']); } + $s = preg_replace_callback('/<!--base64:(.*?)-->/ism', 'smile_unshield', $s); return $s; @@ -1204,11 +1206,11 @@ function smilies($s, $sample = false) { * @return string */ function smile_shield($m) { - return '<!--base64:' . base64url_encode($m[0]) . '-->'; + return '<!--base64:' . base64special_encode($m[0]) . '-->'; } function smile_unshield($m) { - return base64url_decode($m[1]); + return base64special_decode($m[1]); } /** @@ -1603,7 +1605,9 @@ function prepare_text($text, $content_type = 'text/bbcode', $cache = false) { $s = bbcode($text,false,true,$cache); else $s = smilies(bbcode($text,false,true,$cache)); + $s = zidify_links($s); + break; } @@ -1853,6 +1857,26 @@ function base64url_decode($s) { return base64_decode(strtr($s,'-_','+/')); } + +function base64special_encode($s, $strip_padding = true) { + + $s = strtr(base64_encode($s),'+/',',.'); + + if($strip_padding) + $s = str_replace('=','',$s); + + return $s; +} + +function base64special_decode($s) { + if(is_array($s)) { + logger('base64url_decode: illegal input: ' . print_r(debug_backtrace(), true)); + return $s; + } + return base64_decode(strtr($s,',.','+/')); +} + + /** * @ Return a div to clear floats. * @@ -2824,6 +2848,12 @@ function expand_acl($s) { return $ret; } +function acl2json($s) { + $s = expand_acl($s); + $s = json_encode($s); + return $s; +} + // When editing a webpage - a dropdown is needed to select a page layout // On submit, the pdl_select value (which is the mid of an item with item_type = ITEM_TYPE_PDL) is stored in diff --git a/include/widgets.php b/include/widgets.php index 5477dc1e4..68db74703 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -595,7 +595,7 @@ function widget_settings_menu($arr) { } // IF can go away when UNO export and import is fully functional - if(! UNO) { + if(get_config('system','server_role') !== 'basic') { $tabs[] = array( 'label' => t('Export channel'), 'url' => z_root() . '/uexport', @@ -609,7 +609,7 @@ function widget_settings_menu($arr) { 'selected' => ((argv(1) === 'oauth') ? 'active' : ''), ); - if(! UNO) { + if(get_config('system','server_role') !== 'basic') { $tabs[] = array( 'label' => t('Guest Access Tokens'), 'url' => z_root() . '/settings/tokens', diff --git a/include/wiki.php b/include/wiki.php index 424b2d9a0..d52308b08 100644 --- a/include/wiki.php +++ b/include/wiki.php @@ -495,6 +495,12 @@ function wiki_convert_links($s, $wikiURL) { return $s; } +/** + * Replace the instances of the string [toc] with a list element that will be populated by + * a table of contents by the JavaScript library + * @param string $s + * @return string + */ function wiki_generate_toc($s) { if (strpos($s,'[toc]') !== false) { @@ -505,6 +511,39 @@ function wiki_generate_toc($s) { return $s; } +/** + * Converts a select set of bbcode tags. Much of the code is copied from include/bbcode.php + * @param string $s + * @return string + */ +function wiki_bbcode($s) { + + $s = str_replace(array('[baseurl]', '[sitename]'), array(z_root(), get_config('system', 'sitename')), $s); + + $observer = App::get_observer(); + if ($observer) { + $s1 = '<span class="bb_observer" title="' . t('Different viewers will see this text differently') . '">'; + $s2 = '</span>'; + $obsBaseURL = $observer['xchan_connurl']; + $obsBaseURL = preg_replace("/\/poco\/.*$/", '', $obsBaseURL); + $s = str_replace('[observer.baseurl]', $obsBaseURL, $s); + $s = str_replace('[observer.url]', $observer['xchan_url'], $s); + $s = str_replace('[observer.name]', $s1 . $observer['xchan_name'] . $s2, $s); + $s = str_replace('[observer.address]', $s1 . $observer['xchan_addr'] . $s2, $s); + $s = str_replace('[observer.webname]', substr($observer['xchan_addr'], 0, strpos($observer['xchan_addr'], '@')), $s); + $s = str_replace('[observer.photo]', '', $s); + } else { + $s = str_replace('[observer.baseurl]', '', $s); + $s = str_replace('[observer.url]', '', $s); + $s = str_replace('[observer.name]', '', $s); + $s = str_replace('[observer.address]', '', $s); + $s = str_replace('[observer.webname]', '', $s); + $s = str_replace('[observer.photo]', '', $s); + } + + return $s; +} + // This function is derived from // http://stackoverflow.com/questions/32068537/generate-table-of-contents-from-markdown-in-php function wiki_toc($content) { diff --git a/include/zot.php b/include/zot.php index 73d9ef950..4e443652f 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2251,7 +2251,7 @@ function check_location_move($sender_hash,$locations) { if(! $locations) return; - if(! UNO) + if(get_config('system','server_role') !== 'basic') return; if(count($locations) != 1) @@ -2929,7 +2929,7 @@ function import_site($arr, $pubkey) { */ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) { - if(UNO) + if(get_config('system','server_role') === 'basic') return; logger('build_sync_packet'); @@ -3077,7 +3077,7 @@ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) { */ function process_channel_sync_delivery($sender, $arr, $deliveries) { - if(UNO) + if(get_config('system','server_role') === 'basic') return; require_once('include/import.php'); |