Merge branch 'develop' into 'master'

merge upstream/master for 3.8.8

See merge request harukin/core!31
This commit is contained in:
harukin 2018-12-24 01:00:22 +09:00
commit 695c60c3fe
20 changed files with 98 additions and 132 deletions

View File

@ -1,3 +1,21 @@
Hubzilla 3.8.8 (2018-12-22)
- Fix issue with linkinfo
- Fix cURL with HTTP/2
- Remove scale_external_images()
- Style highlight bbcode via css
- Make mod channel deal with b64 encoded mid's
- Fix email retrieval in OAuth2Storage
- Add reinstall option to util/addons
- Remove deprecated caching protection from mod photo
- Add missing check for observer in mod like
- Articles: default to logged in channel if channel name is not passed
- Wiki: fix preview issue with hyperlinks
- Cart: backport fixes from osada
- Gallery: provide file extensions for better compatibility
- Hsse: fix issue when linkinfo data was inserted
- Diaspora: remove deprecated scale_external_images()
Hubzilla 3.8.7 (2018-12-14)
- Fix issue with linkdropper in comment area
- Fix regression wit app ordering

View File

@ -64,7 +64,7 @@ class OAuth2Storage extends \OAuth2\Storage\Pdo {
return( [
'webfinger' => channel_reddress($x),
'portable_id' => $x['channel_hash'],
'email' => $a['account_email'],
'email' => $a[0]['account_email'],
'username' => $x['channel_address'],
'user_id' => $x['channel_id'],
'name' => $x['channel_name'],

View File

@ -17,8 +17,16 @@ class Articles extends Controller {
if(argc() > 1)
$which = argv(1);
else
return;
if(! $which) {
if(local_channel()) {
$channel = App::get_channel();
if($channel && $channel['channel_address'])
$which = $channel['channel_address'];
} else {
return;
}
}
profile_load($which);

View File

@ -80,6 +80,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']) : '');
@ -331,6 +336,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.

View File

@ -50,7 +50,7 @@ class Like extends \Zotlabs\Web\Controller {
$observer = \App::get_observer();
$interactive = $_REQUEST['interactive'];
if($interactive) {
if((! $observer) || ($interactive)) {
$o .= '<h1>' . t('Like/Dislike') . '</h1>';
$o .= EOL . EOL;
@ -249,6 +249,9 @@ class Like extends \Zotlabs\Web\Controller {
}
}
else {
if(! $observer)
killme();
// this is used to like an item or comment

View File

@ -138,8 +138,8 @@ class Linkinfo extends \Zotlabs\Web\Controller {
}
$image = "";
if(sizeof($siteinfo["images"]) > 0){
if(is_array($siteinfo["images"]) && count($siteinfo["images"])){
/* Execute below code only if image is present in siteinfo */
$total_images = 0;
@ -161,7 +161,7 @@ class Linkinfo extends \Zotlabs\Web\Controller {
$total_images ++;
if($max_images && $max_images >= $total_images)
break;
}
}
}
if(strlen($text)) {

View File

@ -988,7 +988,7 @@ class Photos extends \Zotlabs\Web\Controller {
$photo = array(
'href' => z_root() . '/photo/' . $hires['resource_id'] . '-' . $hires['imgscale'] . '.' . $phototypes[$hires['mimetype']],
'title'=> t('View Full Size'),
'src' => z_root() . '/photo/' . $lores['resource_id'] . '-' . $lores['imgscale'] . '.' . $phototypes[$lores['mimetype']] . '?f=&_u=' . datetime_convert('','','','ymdhis')
'src' => z_root() . '/photo/' . $lores['resource_id'] . '-' . $lores['imgscale'] . '.' . $phototypes[$lores['mimetype']]
);
if($nextlink)

View File

@ -442,8 +442,8 @@ class Wiki extends Controller {
$mimeType = $_POST['mimetype'];
if($mimeType === 'text/bbcode') {
$linkconverted = NativeWikiPage::convert_links($content,$wikiURL);
$html = zidify_links(smilies(bbcode($linkconverted)));
$html = zidify_links(smilies(bbcode($content)));
$html = NativeWikiPage::convert_links($html,$wikiURL);
}
elseif($mimeType === 'text/markdown') {
$linkconverted = NativeWikiPage::convert_links($content,$wikiURL);

View File

@ -50,7 +50,7 @@ require_once('include/attach.php');
require_once('include/bbcode.php');
define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '3.8.7' );
define ( 'STD_VERSION', '3.8.8' );
define ( 'ZOT_REVISION', '6.0a' );
define ( 'DB_UPDATE_VERSION', 1225 );

View File

@ -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);
}

View File

@ -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

View File

@ -116,6 +116,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'))
@ -153,7 +156,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-2].+? [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));
@ -286,6 +289,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'))
@ -318,8 +324,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-2].+? [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));
@ -690,99 +695,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.
*

View File

@ -3339,8 +3339,6 @@ function cleanup_bbcode($body) {
$body = preg_replace('/\[\/code\]\s*\[code\]/ism',"\n",$body);
$body = scale_external_images($body,false);
return $body;
}

BIN
picture/harukin-.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

BIN
picture/harukin-Black.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

BIN
picture/harukin-Black2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
picture/icon2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

View File

@ -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) {

View File

@ -1803,3 +1803,8 @@ 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;
}

View File

@ -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;
}