diff options
-rw-r--r-- | Zotlabs/Daemon/Notifier.php | 7 | ||||
-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/Update/_1230.php | 12 | ||||
-rwxr-xr-x | boot.php | 2 | ||||
-rw-r--r-- | include/follow.php | 4 | ||||
-rw-r--r-- | include/markdown.php | 2 | ||||
-rw-r--r-- | include/network.php | 93 | ||||
-rw-r--r-- | include/text.php | 2 | ||||
-rw-r--r-- | include/zot.php | 2 | ||||
-rwxr-xr-x | util/addons | 15 |
12 files changed, 65 insertions, 113 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/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/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/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/markdown.php b/include/markdown.php index 64f0a0854..2513a7d77 100644 --- a/include/markdown.php +++ b/include/markdown.php @@ -91,8 +91,6 @@ function markdown_to_bb($s, $use_zrl = false, $options = []) { // remove duplicate adjacent code tags $s = preg_replace("/(\[code\])+(.*?)(\[\/code\])+/ism","[code]$2[/code]", $s); - // Don't show link to full picture (until it is fixed) - $s = scale_external_images($s, false); /** * @hooks markdown_to_bb diff --git a/include/network.php b/include/network.php index df59a30e6..65770221f 100644 --- a/include/network.php +++ b/include/network.php @@ -710,99 +710,6 @@ function sxml2array ( $xmlObject, $out = array () ) /** - * @brief Scales an external image. - * - * @param string $s - * @param string $include_link default true - * @param string $scale_replace default false - * @return string - */ -function scale_external_images($s, $include_link = true, $scale_replace = false) { - - // Picture addresses can contain special characters - $s = htmlspecialchars_decode($s, ENT_COMPAT); - - $matches = null; - $c = preg_match_all('/\[([zi])mg(.*?)\](.*?)\[\/[zi]mg\]/ism', $s, $matches, PREG_SET_ORDER); - if($c) { - require_once('include/photo/photo_driver.php'); - - foreach($matches as $mtch) { - logger('data: ' . $mtch[2] . ' ' . $mtch[3]); - - if(substr($mtch[2],0,1) == '=') { - $owidth = intval(substr($mtch[2],1)); - if($owidth > 0 && $owidth < 1024) - continue; - } - - $hostname = str_replace('www.','',substr(z_root(),strpos(z_root(),'://')+3)); - if(stristr($mtch[3],$hostname)) - continue; - - // $scale_replace, if passed, is an array of two elements. The - // first is the name of the full-size image. The second is the - // name of a remote, scaled-down version of the full size image. - // This allows Friendica to display the smaller remote image if - // one exists, while still linking to the full-size image - if($scale_replace) - $scaled = str_replace($scale_replace[0], $scale_replace[1], $mtch[3]); - else - $scaled = $mtch[3]; - - if(! strpbrk(substr($scaled, 0, 1), 'zhfmt')) - continue; - - $i = z_fetch_url($scaled, true); - - $cache = get_config('system', 'itemcache'); - if (($cache != '') and is_dir($cache)) { - $cachefile = $cache . '/' . hash('md5', $scaled); - file_put_contents($cachefile, $i['body']); - } - - // guess mimetype from headers or filename - - $type = guess_image_type($mtch[3], $i['header']); - if(strpos($type, 'image') === false) - continue; - - if($i['success']) { - $ph = photo_factory($i['body'], $type); - - if(! is_object($ph)) - continue; - - if($ph->is_valid()) { - $orig_width = $ph->getWidth(); - $orig_height = $ph->getHeight(); - - if($orig_width > 1024 || $orig_height > 1024) { - $tag = (($match[1] == 'z') ? 'zmg' : 'img'); - $linktag = (($match[1] == 'z') ? 'zrl' : 'url'); - $ph->scaleImage(1024); - $new_width = $ph->getWidth(); - $new_height = $ph->getHeight(); - logger('data: ' . $orig_width . '->' . $new_width . 'w ' . $orig_height . '->' . $new_height . 'h' . ' match: ' . $mtch[0], LOGGER_DEBUG); - $s = str_replace($mtch[0],'[' . $tag . '=' . $new_width . 'x' . $new_height. ']' . $scaled . '[/' . $tag . ']' - . "\n" . (($include_link) - ? '[' . $linktag . '=' . $mtch[3] . ']' . t('view full size') . '[/' . $linktag . ']' . "\n" - : ''),$s); - logger('new string: ' . $s, LOGGER_DEBUG); - } - } - } - } - } - - // replace the special char encoding - - $s = htmlspecialchars($s, ENT_COMPAT, 'UTF-8'); - - return $s; -} - -/** * @brief xml2array() will convert the given XML text to an array in the XML structure. * * Link: http://www.bin-co.com/php/scripts/xml2array/ diff --git a/include/text.php b/include/text.php index bd0d8048d..3cc21e4ce 100644 --- a/include/text.php +++ b/include/text.php @@ -3305,8 +3305,6 @@ function cleanup_bbcode($body) { $body = preg_replace('/\[\/code\]\s*\[code\]/ism',"\n",$body); - $body = scale_external_images($body, false); - return $body; } 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) { |