Merge branch 'dev' into 4.4RC

This commit is contained in:
Mario Vavti 2019-08-09 20:33:45 +02:00
commit 681dc70205
5 changed files with 15097 additions and 15154 deletions

View File

@ -2,9 +2,6 @@
namespace Zotlabs\Module; namespace Zotlabs\Module;
class Linkinfo extends \Zotlabs\Web\Controller { class Linkinfo extends \Zotlabs\Web\Controller {
function get() { function get() {
@ -48,7 +45,20 @@ class Linkinfo extends \Zotlabs\Web\Controller {
} }
logger('linkinfo: ' . $url); logger('linkinfo: ' . $url);
// Replace plink URL with 'share' tag if possible
if (preg_match("/mid=b64\.(\w+)(&.+)?$/", $url, $mid)) {
$r = q("SELECT id FROM item WHERE mid = '%s' AND uid = %d LIMIT 1",
dbesc(base64url_decode($mid[1])),
intval(local_channel())
);
if ($r) {
echo "[share=" . $r[0]['id'] . "][/share]";
killme();
}
}
$result = z_fetch_url($url,false,0,array('novalidate' => true, 'nobody' => true)); $result = z_fetch_url($url,false,0,array('novalidate' => true, 'nobody' => true));
if($result['success']) { if($result['success']) {
$hdrs=array(); $hdrs=array();
@ -275,7 +285,7 @@ class Linkinfo extends \Zotlabs\Web\Controller {
// Check codepage in HTTP headers or HTML if not exist // Check codepage in HTTP headers or HTML if not exist
$cp = (preg_match('/Content-Type: text\/html; charset=(.+)\r\n/i', $header, $o) ? $o[1] : ''); $cp = (preg_match('/Content-Type: text\/html; charset=(.+)\r\n/i', $header, $o) ? $o[1] : '');
if(empty($cp)) if(empty($cp))
$cp = (preg_match('/meta.+content=["|\']text\/html; charset=([^"|\']+)/i', $body, $o) ? $o[1] : 'AUTO'); $cp = (preg_match('/meta.+content=["\']text\/html; charset=([^"\']+)/i', $body, $o) ? $o[1] : 'AUTO');
$body = mb_convert_encoding($body, 'UTF-8', $cp); $body = mb_convert_encoding($body, 'UTF-8', $cp);
$body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8"); $body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8");
@ -444,8 +454,9 @@ class Linkinfo extends \Zotlabs\Web\Controller {
while (strpos($text, " ")) while (strpos($text, " "))
$text = trim(str_replace(" ", " ", $text)); $text = trim(str_replace(" ", " ", $text));
$siteinfo["text"] = html_entity_decode(substr($text,0,350), ENT_QUOTES, "UTF-8").'...'; $text = substr(html_entity_decode($text, ENT_QUOTES, "UTF-8"), 0, 350);
$siteinfo["text"] = rtrim(substr($text, 0, strrpos($text, " ")), "?.,:;!-") . '...';
} }
} }

View File

@ -50,7 +50,7 @@ require_once('include/attach.php');
require_once('include/bbcode.php'); require_once('include/bbcode.php');
define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '4.4RC' ); define ( 'STD_VERSION', '4.5' );
define ( 'ZOT_REVISION', '6.0a' ); define ( 'ZOT_REVISION', '6.0a' );
define ( 'DB_UPDATE_VERSION', 1234 ); define ( 'DB_UPDATE_VERSION', 1234 );

View File

@ -205,20 +205,25 @@ function zidify_text($s) {
*/ */
function red_zrl_callback($matches) { function red_zrl_callback($matches) {
$zrl = is_matrix_url($matches[2]); // Catch and exclude trailing punctuation
preg_match("/[.,;:!?)]*$/i", $matches[2], $pts);
$t = strip_zids($matches[2]); $matches[2] = substr($matches[2], 0, strlen($matches[2])-strlen($pts[0]));
if($t !== $matches[2]) {
$zrl = true; $zrl = is_matrix_url($matches[2]);
$matches[2] = $t;
} $t = strip_zids($matches[2]);
if($t !== $matches[2]) {
if($matches[1] === '#^') $zrl = true;
$matches[1] = ''; $matches[2] = $t;
if($zrl) }
return $matches[1] . '#^[zrl=' . $matches[2] . ']' . $matches[2] . '[/zrl]';
if($matches[1] === '#^')
return $matches[1] . '#^[url=' . $matches[2] . ']' . $matches[2] . '[/url]'; $matches[1] = '';
if($zrl)
return $matches[1] . '#^[zrl=' . $matches[2] . ']' . $matches[2] . '[/zrl]' . $pts[0];
return $matches[1] . '#^[url=' . $matches[2] . ']' . $matches[2] . '[/url]' . $pts[0];
} }
/** /**

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff