diff options
author | Max Kostikov <max@kostikov.co> | 2018-12-20 20:51:26 +0100 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2018-12-20 20:51:26 +0100 |
commit | 89e734dcca1525fa804343d6ecf5286ce70b05ba (patch) | |
tree | 10d0a3614e9f97f5065ea53fff1c3d5fcd292c16 | |
parent | 3a662555768840d18c6dbba027af644eda54f20e (diff) | |
parent | 090fe394e4733aea9e9ca2e9a93c2c27b266d065 (diff) | |
download | volse-hubzilla-89e734dcca1525fa804343d6ecf5286ce70b05ba.tar.gz volse-hubzilla-89e734dcca1525fa804343d6ecf5286ce70b05ba.tar.bz2 volse-hubzilla-89e734dcca1525fa804343d6ecf5286ce70b05ba.zip |
Merge branch 'dev' into 'dev'
Sync dev
See merge request kostikov/core!1
-rw-r--r-- | Zotlabs/Daemon/Notifier.php | 7 | ||||
-rw-r--r-- | Zotlabs/Lib/Activity.php | 89 | ||||
-rw-r--r-- | Zotlabs/Lib/Libzot.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Channel.php | 8 | ||||
-rw-r--r-- | Zotlabs/Module/Connedit.php | 27 | ||||
-rw-r--r-- | Zotlabs/Module/Like.php | 3 | ||||
-rw-r--r-- | Zotlabs/Module/Setup.php | 5 | ||||
-rw-r--r-- | Zotlabs/Update/_1230.php | 12 | ||||
-rwxr-xr-x | boot.php | 2 | ||||
-rw-r--r-- | include/bbcode.php | 2 | ||||
-rw-r--r-- | include/follow.php | 4 | ||||
-rw-r--r-- | include/network.php | 10 | ||||
-rw-r--r-- | include/zot.php | 2 | ||||
-rwxr-xr-x | util/addons | 15 | ||||
-rw-r--r-- | view/theme/redbasic/css/style.css | 6 | ||||
-rw-r--r-- | view/theme/redbasic/schema/dark.css | 41 |
16 files changed, 196 insertions, 41 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index 8b81c49da..beb30ed96 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -625,7 +625,12 @@ class Notifier { continue; } - $hash = new_uuid(); + // Do not change this to a uuid as long as we have traditional zot servers + // in the loop. The signature verification step can't handle dashes in the + // hashes. + + $hash = random_string(48); + $packet = null; $pmsg = ''; diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 8cef41c42..ef6ee6c3e 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -546,6 +546,12 @@ class Activity { } + + + + + + static function activity_mapper($verb) { if(strpos($verb,'/') === false) { @@ -588,6 +594,67 @@ class Activity { } + + static function activity_decode_mapper($verb) { + + $acts = [ + 'http://activitystrea.ms/schema/1.0/post' => 'Create', + 'http://activitystrea.ms/schema/1.0/share' => 'Announce', + 'http://activitystrea.ms/schema/1.0/update' => 'Update', + 'http://activitystrea.ms/schema/1.0/like' => 'Like', + 'http://activitystrea.ms/schema/1.0/favorite' => 'Like', + 'http://purl.org/zot/activity/dislike' => 'Dislike', + 'http://activitystrea.ms/schema/1.0/tag' => 'Add', + 'http://activitystrea.ms/schema/1.0/follow' => 'Follow', + 'http://activitystrea.ms/schema/1.0/unfollow' => 'Unfollow', + ]; + + + foreach($acts as $k => $v) { + if($verb === $v) { + return $k; + } + } + + logger('Unmapped activity: ' . $verb); + return 'Create'; + + } + + static function activity_obj_decode_mapper($obj) { + + $objs = [ + 'http://activitystrea.ms/schema/1.0/note' => 'Note', + 'http://activitystrea.ms/schema/1.0/note' => 'Article', + 'http://activitystrea.ms/schema/1.0/comment' => 'Note', + 'http://activitystrea.ms/schema/1.0/person' => 'Person', + 'http://purl.org/zot/activity/profile' => 'Profile', + 'http://activitystrea.ms/schema/1.0/photo' => 'Image', + 'http://activitystrea.ms/schema/1.0/profile-photo' => 'Icon', + 'http://activitystrea.ms/schema/1.0/event' => 'Event', + 'http://activitystrea.ms/schema/1.0/wiki' => 'Document', + 'http://purl.org/zot/activity/location' => 'Place', + 'http://purl.org/zot/activity/chessgame' => 'Game', + 'http://purl.org/zot/activity/tagterm' => 'zot:Tag', + 'http://purl.org/zot/activity/thing' => 'Object', + 'http://purl.org/zot/activity/file' => 'zot:File', + 'http://purl.org/zot/activity/mood' => 'zot:Mood', + + ]; + + foreach($objs as $k => $v) { + if($obj === $v) { + return $k; + } + } + + logger('Unmapped activity object: ' . $obj); + return 'Note'; + } + + + + static function activity_obj_mapper($obj) { if(strpos($obj,'/') === false) { @@ -1236,6 +1303,20 @@ class Activity { } + static function get_actor_bbmention($id) { + + $x = q("select * from hubloc left join xchan on hubloc_hash = xchan_hash where hubloc_hash = '%s' or hubloc_id_url = '%s' limit 1", + dbesc($id), + dbesc($id) + ); + + if($x) { + return sprintf('@[zrl=%s]%s[/zrl]',$x[0]['xchan_url'],$x[0]['xchan_name']); + } + return '@{' . $id . '}'; + + } + static function decode_note($act) { @@ -1320,13 +1401,17 @@ class Activity { $s['summary'] = self::bb_content($content,'summary'); $s['body'] = ((self::bb_content($content,'bbcode') && (! $response_activity)) ? self::bb_content($content,'bbcode') : self::bb_content($content,'content')); - $s['verb'] = self::activity_mapper($act->type); + $s['verb'] = self::activity_decode_mapper($act->type); if($act->type === 'Tombstone') { $s['item_deleted'] = 1; } - $s['obj_type'] = self::activity_obj_mapper($act->obj['type']); + $s['obj_type'] = self::activity_obj_decode_mapper($act->obj['type']); + if($s['obj_type'] === ACTIVITY_OBJ_NOTE && $s['mid'] !== $s['parent_mid']) { + $s['obj_type'] = ACTIVITY_OBJ_COMMENT; + } + $s['obj'] = $act->obj; $instrument = $act->get_property_obj('instrument'); diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index 0fbde9765..87a5126f4 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -397,9 +397,7 @@ logger('4'); } } - $closeness = get_pconfig($channel['channel_id'],'system','new_abook_closeness'); - if($closeness === false) - $closeness = 80; + $closeness = get_pconfig($channel['channel_id'],'system','new_abook_closeness',80); $y = abook_store_lowlevel( [ diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 12d87885f..5fdefd805 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -124,6 +124,11 @@ class Channel extends Controller { $mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : ''); + if(strpos($mid,'b64.') === 0) + $decoded = @base64url_decode(substr($mid,4)); + if($decoded) + $mid = $decoded; + $datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : ''); $datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : ''); @@ -375,6 +380,9 @@ class Channel extends Controller { if((! $update) && (! $load)) { + if($decoded) + $mid = 'b64.' . base64url_encode($mid); + // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, // because browser prefetching might change it on us. We have to deliver it with the page. diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index a9f643306..c14bcd0dd 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -101,7 +101,8 @@ class Connedit extends \Zotlabs\Web\Controller { } - $profile_id = $_POST['profile_assign']; + $profile_id = ((array_key_exists('profile_assign',$_POST)) ? $_POST['profile_assign'] : $orig_record[0]['abook_profile']); + if($profile_id) { $r = q("SELECT profile_guid FROM profile WHERE profile_guid = '%s' AND uid = %d LIMIT 1", dbesc($profile_id), @@ -113,18 +114,23 @@ class Connedit extends \Zotlabs\Web\Controller { } } - $abook_incl = escape_tags($_POST['abook_incl']); - $abook_excl = escape_tags($_POST['abook_excl']); - + $abook_incl = ((array_key_exists('abook_incl',$_POST)) ? escape_tags($_POST['abook_incl']) : $orig_record[0]['abook_incl']); + $abook_excl = ((array_key_exists('abook_excl',$_POST)) ? escape_tags($_POST['abook_excl']) : $orig_record[0]['abook_excl']); + + $hidden = intval($_POST['hidden']); $priority = intval($_POST['poll']); if($priority > 5 || $priority < 0) $priority = 0; + if(! array_key_exists('closeness',$_POST)) { + $_POST['closeness'] = 80; + } $closeness = intval($_POST['closeness']); - if($closeness < 0) - $closeness = 99; + if($closeness < 0 || $closeness > 99) { + $closeness = 80; + } $rating = intval($_POST['rating']); if($rating < (-10)) @@ -231,6 +237,8 @@ class Connedit extends \Zotlabs\Web\Controller { } $abook_pending = (($new_friend) ? 0 : $orig_record[0]['abook_pending']); + + $r = q("UPDATE abook SET abook_profile = '%s', abook_closeness = %d, abook_pending = %d, abook_incl = '%s', abook_excl = '%s' @@ -733,9 +741,12 @@ class Connedit extends \Zotlabs\Web\Controller { } $slider_tpl = get_markup_template('contact_slider.tpl'); + + $slideval = intval($contact['abook_closeness']); + $slide = replace_macros($slider_tpl,array( '$min' => 1, - '$val' => (($contact['abook_closeness']) ? $contact['abook_closeness'] : 99), + '$val' => $slideval, '$labels' => $label_str, )); } @@ -892,7 +903,7 @@ class Connedit extends \Zotlabs\Web\Controller { '$inherited' => t('inherited'), '$submit' => t('Submit'), '$lbl_vis2' => sprintf( t('Please choose the profile you would like to display to %s when viewing your profile securely.'), $contact['xchan_name']), - '$close' => $contact['abook_closeness'], + '$close' => (($contact['abook_closeness']) ? $contact['abook_closeness'] : 80), '$them' => t('Their Settings'), '$me' => t('My Settings'), '$perms' => $perms, diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index d19154eb4..0455c5265 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -251,6 +251,9 @@ class Like extends \Zotlabs\Web\Controller { } } else { + + if(! $observer) + killme(); // this is used to like an item or comment diff --git a/Zotlabs/Module/Setup.php b/Zotlabs/Module/Setup.php index c0716ca7c..370b7b9f8 100644 --- a/Zotlabs/Module/Setup.php +++ b/Zotlabs/Module/Setup.php @@ -441,13 +441,18 @@ class Setup extends \Zotlabs\Web\Controller { require_once 'include/environment.php'; $help = ''; + $mem_warning = ''; $result = getPhpiniUploadLimits(); + if($result['post_max_size'] < 4194304 || $result['max_upload_filesize'] < 4194304) { + $mem_warning = '<strong>' .t('This is not sufficient to upload larger images or files. You should be able to upload at least 4 MB at once.') . '</strong>'; + } $help = sprintf(t('Your max allowed total upload size is set to %s. Maximum size of one file to upload is set to %s. You are allowed to upload up to %d files at once.'), userReadableSize($result['post_max_size']), userReadableSize($result['max_upload_filesize']), $result['max_file_uploads'] ); + $help .= $mem_warning; $help .= '<br><br>' . t('You can adjust these settings in the server php.ini file.'); $this->check_add($checks, t('PHP upload limits'), true, false, $help); diff --git a/Zotlabs/Update/_1230.php b/Zotlabs/Update/_1230.php new file mode 100644 index 000000000..fe59f2e08 --- /dev/null +++ b/Zotlabs/Update/_1230.php @@ -0,0 +1,12 @@ +<?php + +namespace Zotlabs\Update; + +class _1230 { + + function run() { + q("update abook set abook_closeness = 80 where abook_closeness = 0 and abook_self = 0"); + return UPDATE_SUCCESS; + + } +}
\ No newline at end of file @@ -53,7 +53,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'STD_VERSION', '3.9.5' ); define ( 'ZOT_REVISION', '6.0a' ); -define ( 'DB_UPDATE_VERSION', 1229 ); +define ( 'DB_UPDATE_VERSION', 1230 ); define ( 'PROJECT_BASE', __DIR__ ); diff --git a/include/bbcode.php b/include/bbcode.php index c5d6ef998..817986da0 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -1021,7 +1021,7 @@ function bbcode($Text, $options = []) { } // Check for colored text if (strpos($Text,'[/hl]') !== false) { - $Text = preg_replace("(\[hl\](.*?)\[\/hl\])ism", "<span style=\"background-color: yellow;\">$1</span>", $Text); + $Text = preg_replace("(\[hl\](.*?)\[\/hl\])ism", "<span class=\"default-highlight\">$1</span>", $Text); $Text = preg_replace("(\[hl=(.*?)\](.*?)\[\/hl\])ism", "<span style=\"background-color: $1;\">$2</span>", $Text); } diff --git a/include/follow.php b/include/follow.php index 964c43ff2..038e6e9c0 100644 --- a/include/follow.php +++ b/include/follow.php @@ -266,9 +266,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false) } } else { - $closeness = get_pconfig($uid,'system','new_abook_closeness'); - if($closeness === false) - $closeness = 80; + $closeness = get_pconfig($uid,'system','new_abook_closeness',80); $r = abook_store_lowlevel( [ diff --git a/include/network.php b/include/network.php index e07001fa3..8ac71011e 100644 --- a/include/network.php +++ b/include/network.php @@ -120,6 +120,9 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { @curl_setopt($ch, CURLOPT_USERPWD, $opts['http_auth']); } + if(array_key_exists('http_version',$opts)) + @curl_setopt($ch,CURLOPT_HTTP_VERSION,$opts['http_version']); + if(x($opts,'cookiejar')) @curl_setopt($ch, CURLOPT_COOKIEJAR, $opts['cookiejar']); if(x($opts,'cookiefile')) @@ -157,7 +160,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { // Pull out multiple headers, e.g. proxy and continuation headers // allow for HTTP/2.x without fixing code - while(preg_match('/^HTTP\/[1-3].+? [1-5][0-9][0-9]/',$base)) { + while(preg_match('/^HTTP\/[1-3](\.\d)? [1-5][0-9][0-9]/',$base)) { $chunk = substr($base,0,strpos($base,"\r\n\r\n")+4); $header .= $chunk; $base = substr($base,strlen($chunk)); @@ -290,6 +293,9 @@ function z_post_url($url, $params, $redirects = 0, $opts = array()) { @curl_setopt($ch, CURLOPT_USERPWD, $opts['http_auth']); } + if(array_key_exists('http_version',$opts)) + @curl_setopt($ch,CURLOPT_HTTP_VERSION,$opts['http_version']); + if(x($opts,'cookiejar')) @curl_setopt($ch, CURLOPT_COOKIEJAR, $opts['cookiejar']); if(x($opts,'cookiefile')) @@ -323,7 +329,7 @@ function z_post_url($url, $params, $redirects = 0, $opts = array()) { // Pull out multiple headers, e.g. proxy and continuation headers // allow for HTTP/2.x without fixing code - while(preg_match('/^HTTP\/[1-3].+? [1-5][0-9][0-9]/',$base)) { + while(preg_match('/^HTTP\/[1-3](\.\d)? [1-5][0-9][0-9]/',$base)) { $chunk = substr($base,0,strpos($base,"\r\n\r\n")+4); $header .= $chunk; $base = substr($base,strlen($chunk)); diff --git a/include/zot.php b/include/zot.php index d031b4a96..9934dae07 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1232,6 +1232,7 @@ function zot_fetch($arr) { $datatosend = json_encode(crypto_encapsulate(json_encode($data),$hub['hubloc_sitekey'], $algorithm)); $import = zot_zot($url,$datatosend); + } else { $algorithm = zot_best_algorithm($hub['site_crypto']); @@ -4913,6 +4914,7 @@ function zot_reply_pickup($data) { dbesc($data['secret']), dbesc($data['callback']) ); + if(! $r) { $ret['message'] = 'nothing to pick up'; logger('mod_zot: pickup: ' . $ret['message']); diff --git a/util/addons b/util/addons index 3d772bf73..7bd70984e 100755 --- a/util/addons +++ b/util/addons @@ -10,6 +10,7 @@ echo <<< EOT util/addons list all # list all addons (*)= installed, (!)= disabled due to version compatibility util/addons install foo # install addon named 'foo' util/addons uninstall foo # uninstall addon named 'foo' + util/addons reinstall # reinstall all plugins EOT; } @@ -68,6 +69,20 @@ if($argc == 2 && $argv[1] === 'list') { killme(); } +if($argc == 2 && $argv[1] === 'reinstall') { + require_once("include/plugin.php"); + if($plugins) { + foreach($plugins as $p) { + if($p[1]) { + echo "Reinstall: ". $p[0] . "\n"; + uninstall_plugin($p[0]); + install_plugin($p[0]); + } + } + } + killme(); +} + if($argc == 3 && $argv[1] === 'list' && $argv[2] === 'all') { if($plugins) { diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index f2c1b7a48..b406e710c 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -1803,3 +1803,9 @@ dl.bb-dl > dd > li { .hover-fx-show:hover .hover-fx-hide { opacity: 1; } + +/* default highlighted text if not specified by schema: */ +span.default-highlight { + background-color: yellow; + padding: 2px 4px; +} diff --git a/view/theme/redbasic/schema/dark.css b/view/theme/redbasic/schema/dark.css index e958d9ee7..bf55fec72 100644 --- a/view/theme/redbasic/schema/dark.css +++ b/view/theme/redbasic/schema/dark.css @@ -322,20 +322,6 @@ a, a:visited, a:link, .fakelink, .fakelink:visited, .fakelink:link { .text-dark { color: #aaa !important; } -a.text-dark:focus, a.text-dark:hover { - color: #ddd !important; -} - -.badge-warning { - background-color: #ffc927; -} -.badge-warning a.text-dark { - color: #333 !important; -} -.badge-warning a.text-dark:focus, .badge-warning a.text-dark:hover { - color: red !important; - text-decoration: none; -} .group-selected, .fileas-selected, .categories-selected, .search-selected, a.active { color: #fff !important; @@ -492,10 +478,25 @@ pre { background-color: #222; } -/* change color of [hl] tag: */ -div.wall-item-body span /*strong:only-of-type */{ - color: #1212b6; - padding: 2px 3px; -/* font-weight: 500; */ - white-space: nowrap; + +/* category badge fix: */ +a.text-dark:focus, a.text-dark:hover { + color: #ddd !important; +} + +.badge-warning { +/* background-color: #ffc927; */ +} +.badge-warning a.text-dark { + color: #333 !important; +} +.badge-warning a.text-dark:focus, .badge-warning a.text-dark:hover { + color: red !important; + text-decoration: none; +} + +/* fix color for highlithed text */ +span.default-highlight { + color: #333; + border-radius: 4px; } |