Merge branch 'master' into tres

Conflicts:
	include/Import/refimport.php
	include/activities.php
	include/attach.php
	include/event.php
	include/externals.php
	include/identity.php
	include/items.php
	include/notifier.php
	include/photos.php
	include/taxonomy.php
	include/zot.php
	mod/channel.php
	mod/connedit.php
	mod/events.php
	mod/item.php
	mod/like.php
	mod/manage.php
	mod/mood.php
	mod/ping.php
	mod/poke.php
	mod/subthread.php
	mod/tagger.php
	mod/thing.php
This commit is contained in:
redmatrix
2015-05-14 18:02:29 -07:00
187 changed files with 10011 additions and 9772 deletions

View File

@@ -1,11 +1,11 @@
<?php /** @file */
namespace RedMatrix\Import;
namespace Hubzilla\Import;
/**
* @brief Class Import
*
* @package RedMatrix\Import
* @package Hubzilla\Import
*/
class Import {

View File

@@ -88,6 +88,7 @@ function refimport_content(&$a) {
$arr['author_xchan'] = $channel['channel_hash'];
$arr['owner_xchan'] = $channel['channel_hash'];
$arr['app'] = REFLECT_BLOGNAME;
$arr['item_origin'] = 1;
$arr['item_wall'] = 1;
$arr['item_thread_top'] = 1;
@@ -208,7 +209,7 @@ function reflect_find_user($users,$name) {
function reflect_comment_store($channel,$post,$comment,$user) {
// if the commenter was the channel owner, use their redmatrix xchan
// if the commenter was the channel owner, use their hubzilla xchan
if($comment['author'] === REFLECT_EXPORTUSERNAME && $comment['registered'])
$hash = $channel['xchan_hash'];
@@ -259,7 +260,11 @@ function reflect_comment_store($channel,$post,$comment,$user) {
$arr['edited'] = $comment['created'];
$arr['author_xchan'] = $hash;
$arr['owner_xchan'] = $channel['channel_hash'];
<<<<<<< HEAD
$arr['item_origin'] = 1;
=======
$arr['item_flags'] = ITEM_ORIGIN;
>>>>>>> master
$arr['item_wall'] = 1;
$arr['verb'] = ACTIVITY_POST;
$arr['comment_policy'] = 'contacts';

View File

@@ -1,6 +1,6 @@
<?php
namespace RedMatrix\RedDAV;
namespace Hubzilla\RedDAV;
use Sabre\DAV;

View File

@@ -1,6 +1,6 @@
<?php
namespace RedMatrix\RedDAV;
namespace Hubzilla\RedDAV;
use Sabre\DAV;

View File

@@ -1,6 +1,6 @@
<?php
namespace RedMatrix\RedDAV;
namespace Hubzilla\RedDAV;
use Sabre\DAV;

View File

@@ -1,6 +1,6 @@
<?php
namespace RedMatrix\RedDAV;
namespace Hubzilla\RedDAV;
use Sabre\DAV;
@@ -29,7 +29,7 @@ class RedFile extends DAV\Node implements DAV\IFile {
private $data;
/**
* @see \Sabre\DAV\Auth\Backend\BackendInterface
* @var \RedMatrix\RedDAV\RedBasicAuth
* @var \Hubzilla\RedDAV\RedBasicAuth
*/
private $auth;
/**

View File

@@ -21,10 +21,10 @@ function profile_activity($changed, $value) {
$arr['uid'] = local_channel();
$arr['aid'] = $self['channel_account_id'];
$arr['owner_xchan'] = $arr['author_xchan'] = $self['xchan_hash'];
$arr['item_wall'] = 1;
$arr['item_origin'] = 1;
$arr['item_thread_top'] = 1;
$arr['verb'] = ACTIVITY_UPDATE;
$arr['obj_type'] = ACTIVITY_OBJ_PROFILE;

View File

@@ -1934,8 +1934,8 @@ require_once('include/items.php');
'broughtbyurl' => '', 'timezone' => 'UTC', 'closed' => $closed, 'inviteonly' => 'false',
'private' => $private, 'textlimit' => $textlimit, 'sslserver' => $sslserver, 'ssl' => $ssl,
'shorturllength' => '30',
'redmatrix' => array(
'RED_PLATFORM' => RED_PLATFORM,
'hubzilla' => array(
'PLATFORM_NAME' => PLATFORM_NAME,
'RED_VERSION' => RED_VERSION,
'ZOT_REVISION' => ZOT_REVISION,
'DB_UPDATE_VERSION' => DB_UPDATE_VERSION

View File

@@ -450,7 +450,7 @@ function format_event_diaspora($ev) {
$bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM
$o = t('Redmatrix event notification:') . "\n";
$o = t('Hubzilla event notification:') . "\n";
$o .= '**' . (($ev['summary']) ? bb2diaspora($ev['summary']) : bb2diaspora($ev['desc'])) . '**' . "\n";

View File

@@ -292,7 +292,7 @@ function bb_ShareAttributesSimple($match) {
if ($matches[1] != "")
$profile = $matches[1];
$text = '<br />' . html_entity_decode("&#x2672; ", ENT_QUOTES, 'UTF-8') . ' <a href="' . $profile . '">' . $author . '</a>: div class="reshared-content">' . $match[2] . '</div>';
$text = html_entity_decode("&#x2672; ", ENT_QUOTES, 'UTF-8') . ' <a href="' . $profile . '">' . $author . '</a>: div class="reshared-content">' . $match[2] . '</div>';
return($text);
}
@@ -381,10 +381,49 @@ function bb_sanitize_style($input) {
return '<span style="' . $css_string_san . '">' . $input[2] . '</span>';
}
function bb_observer($Text) {
$a = get_app();
$observer = $a->get_observer();
if ((strpos($Text,'[/observer]') !== false) || (strpos($Text,'[/rpost]') !== false)) {
if ($observer) {
$Text = preg_replace("/\[observer\=1\](.*?)\[\/observer\]/ism", '$1', $Text);
$Text = preg_replace("/\[observer\=0\].*?\[\/observer\]/ism", '', $Text);
$Text = preg_replace_callback("/\[rpost(=(.*?))?\](.*?)\[\/rpost\]/ism", 'rpost_callback', $Text);
} else {
$Text = preg_replace("/\[observer\=1\].*?\[\/observer\]/ism", '', $Text);
$Text = preg_replace("/\[observer\=0\](.*?)\[\/observer\]/ism", '$1', $Text);
$Text = preg_replace("/\[rpost(=.*?)?\](.*?)\[\/rpost\]/ism", '', $Text);
}
}
$channel = $a->get_channel();
if (strpos($Text,'[/channel]') !== false) {
if ($channel) {
$Text = preg_replace("/\[channel\=1\](.*?)\[\/channel\]/ism", '$1', $Text);
$Text = preg_replace("/\[channel\=0\].*?\[\/channel\]/ism", '', $Text);
} else {
$Text = preg_replace("/\[channel\=1\].*?\[\/channel\]/ism", '', $Text);
$Text = preg_replace("/\[channel\=0\](.*?)\[\/channel\]/ism", '$1', $Text);
}
}
return $Text;
}
// BBcode 2 HTML was written by WAY2WEB.net
// extended to work with Mistpark/Friendica/Red - Mike Macgirvin
function bbcode($Text, $preserve_nl = false, $tryoembed = true) {
function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) {
$a = get_app();
@@ -420,7 +459,8 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true) {
// process [observer] tags before we do anything else because we might
// be stripping away stuff that then doesn't need to be worked on anymore
if(get_config('system','item_cache'))
if($cache)
$observer = false;
else
$observer = $a->get_observer();
@@ -437,7 +477,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true) {
}
}
if(get_config('system','item_cache'))
if($cache)
$channel = false;
else
$channel = $a->get_channel();

View File

@@ -101,11 +101,22 @@ function comanche_parser(&$a, $s, $pass = 0) {
}
function comanche_menu($name, $class = '') {
function comanche_menu($s, $class = '') {
$channel_id = comanche_get_channel_id();
$name = $s;
$cnt = preg_match_all("/\[var=(.*?)\](.*?)\[\/var\]/ism", $s, $matches, PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
$var[$mtch[1]] = $mtch[2];
$name = str_replace($mtch[0], '', $name);
}
}
if($channel_id) {
$m = menu_fetch($name,$channel_id, get_observer_hash());
return menu_render($m, $class);
return menu_render($m, $class, $edit = false, $var);
}
}
@@ -133,10 +144,11 @@ function comanche_get_channel_id() {
return $channel_id;
}
function comanche_block($s) {
function comanche_block($s, $class = '') {
$var = array();
$matches = array();
$name = $s;
$class = (($class) ? $class : 'bblock widget');
$cnt = preg_match_all("/\[var=(.*?)\](.*?)\[\/var\]/ism", $s, $matches, PREG_SET_ORDER);
if($cnt) {
@@ -155,7 +167,7 @@ function comanche_block($s) {
dbesc($name)
);
if($r) {
$o .= (($var['wrap'] == 'none') ? '' : '<div class="bblock widget">');
$o .= (($var['wrap'] == 'none') ? '' : '<div class="' . $class . '">');
if($r[0]['title'])
$o .= '<h3>' . $r[0]['title'] . '</h3>';
@@ -167,6 +179,33 @@ function comanche_block($s) {
return $o;
}
function comanche_js($s) {
switch($s) {
case 'jquery':
$path = 'view/js/jquery.js';
break;
case 'bootstrap':
$path = 'library/bootstrap/js/bootstrap.min.js';
break;
}
return '<script src="' . z_root() . '/' . $path . '" ></script>';
}
function comanche_css($s) {
switch($s) {
case 'bootstrap':
$path = 'library/bootstrap/css/bootstrap.min.css';
break;
}
return '<link rel="stylesheet" href="' . z_root() . '/' . $path . '" type="text/css" media="screen">';
}
// This doesn't really belong in Comanche, but it could also be argued that it is the perfect place.
// We need to be able to select what kind of template and decoration to use for the webpage at the heart of our content.
// For now we'll allow an '[authored]' element which defaults to name and date, or 'none' to remove these, and perhaps
@@ -206,6 +245,9 @@ function comanche_widget($name, $text) {
}
}
if(file_exists('widget/' . trim($name) . '.php'))
require_once('widget/' . trim($name) . '.php');
$func = 'widget_' . trim($name);
if (function_exists($func))
return $func($vars);
@@ -238,6 +280,26 @@ function comanche_region(&$a, $s) {
}
}
$cnt = preg_match_all("/\[block=(.*?)\](.*?)\[\/block\]/ism", $s, $matches, PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
$s = str_replace($mtch[0],comanche_block(trim($mtch[2]),trim($mtch[1])),$s);
}
}
$cnt = preg_match_all("/\[js\](.*?)\[\/js\]/ism", $s, $matches, PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
$s = str_replace($mtch[0],comanche_js(trim($mtch[1])),$s);
}
}
$cnt = preg_match_all("/\[css\](.*?)\[\/css\]/ism", $s, $matches, PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
$s = str_replace($mtch[0],comanche_css(trim($mtch[1])),$s);
}
}
// need to modify this to accept parameters
$cnt = preg_match_all("/\[widget=(.*?)\](.*?)\[\/widget\]/ism", $s, $matches, PREG_SET_ORDER);

View File

@@ -329,7 +329,7 @@ function find_diaspora_person_by_handle($handle) {
if(! $person) {
// try webfinger. Make sure to distinguish between diaspora,
// redmatrix w/diaspora protocol and friendica w/diaspora protocol.
// hubzilla w/diaspora protocol and friendica w/diaspora protocol.
$result = discover_by_webbie($handle);
if($result) {
@@ -706,8 +706,8 @@ function diaspora_request($importer,$xml) {
$cnv = random_string();
$mid = random_string();
$msg = t('You have started sharing with a Redmatrix premium channel.');
$msg .= t('Redmatrix premium channels are not available for sharing with Diaspora members. This sharing request has been blocked.') . "\r";
$msg = t('You have started sharing with a Hubzilla premium channel.');
$msg .= t('Hubzilla premium channels are not available for sharing with Diaspora members. This sharing request has been blocked.') . "\r";
$msg .= t('Please do not reply to this message, as this channel is not sharing with you and any reply will not be seen by the recipient.') . "\r";
$created = datetime_convert('UTC','UTC',$item['created'],'Y-m-d H:i:s \U\T\C');
@@ -1521,7 +1521,7 @@ function diaspora_comment($importer,$xml,$msg) {
$key = get_config('system','pubkey');
$x = array('signer' => $diaspora_handle, 'body' => $text,
'signed_text' => $signed_data, 'signature' => base64_encode($author_signature));
$datarray['diaspora_meta'] = json_encode(crypto_encapsulate(json_encode($x),$key));
$datarray['diaspora_meta'] = json_encode($x);
}
@@ -2135,7 +2135,7 @@ function diaspora_like($importer,$xml,$msg) {
$key = get_config('system','pubkey');
$x = array('signer' => $diaspora_handle, 'body' => $text,
'signed_text' => $signed_data, 'signature' => base64_encode($author_signature));
$arr['diaspora_meta'] = json_encode(crypto_encapsulate(json_encode($x),$key));
$arr['diaspora_meta'] = json_encode($x);
}
$x = item_store($arr);
@@ -2418,6 +2418,20 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
}
*/
if($item['item_flags'] & ITEM_CONSENSUS) {
$poll = replace_macros(get_markup_template('diaspora_consensus.tpl'), array(
'$guid_q' => random_string(),
'$question' => t('Please choose'),
'$guid_y' => random_string(),
'$agree' => t('Agree'),
'$guid_n' => random_string(),
'$disagree' => t('Disagree'),
'$guid_a' => random_string(),
'$abstain' => t('Abstain')
));
}
else
$poll = '';
$public = (($item['item_private']) ? 'false' : 'true');
@@ -2435,17 +2449,18 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
'$handle' => xmlify($myaddr),
'$public' => $public,
'$created' => $created,
'$provider' => (($item['app']) ? $item['app'] : 'redmatrix')
'$provider' => (($item['app']) ? $item['app'] : 'hubzilla')
));
} else {
$tpl = get_markup_template('diaspora_post.tpl');
$msg = replace_macros($tpl, array(
'$body' => xmlify($body),
'$guid' => $item['mid'],
'$poll' => $poll,
'$handle' => xmlify($myaddr),
'$public' => $public,
'$created' => $created,
'$provider' => (($item['app']) ? $item['app'] : 'redmatrix')
'$provider' => (($item['app']) ? $item['app'] : 'hubzilla')
));
}

View File

@@ -55,8 +55,8 @@ function notification($params) {
push_lang($recip['account_language']); // should probably have a channel language
$banner = t('Red Matrix Notification');
$product = t('redmatrix'); // RED_PLATFORM;
$banner = t('Hubzilla Notification');
$product = t('hubzilla'); // PLATFORM_NAME;
$siteurl = $a->get_baseurl(true);
$thanks = t('Thank You,');
$sitename = get_config('system','sitename');

View File

@@ -62,7 +62,7 @@ function ical_wrapper($ev) {
$o .= "BEGIN:VCALENDAR";
$o .= "\nVERSION:2.0";
$o .= "\nMETHOD:PUBLISH";
$o .= "\nPRODID:-//" . get_config('system','sitename') . "//" . RED_PLATFORM . "//" . strtoupper(get_app()->language). "\n";
$o .= "\nPRODID:-//" . get_config('system','sitename') . "//" . PLATFORM_NAME . "//" . strtoupper(get_app()->language). "\n";
if(array_key_exists('start', $ev))
$o .= format_event_ical($ev);
else {

View File

@@ -481,7 +481,7 @@ function identity_basic_export($channel_id, $items = false) {
$ret = array();
$ret['compatibility'] = array('project' => RED_PLATFORM, 'version' => RED_VERSION, 'database' => DB_UPDATE_VERSION);
$ret['compatibility'] = array('project' => PLATFORM_NAME, 'version' => RED_VERSION, 'database' => DB_UPDATE_VERSION);
$r = q("select * from channel where channel_id = %d limit 1",
intval($channel_id)
@@ -1369,7 +1369,7 @@ function get_default_profile_photo($size = 175) {
}
/**
* @brief Test whether a given identity is NOT a member of the Red Matrix.
* @brief Test whether a given identity is NOT a member of the Hubzilla.
*
* @param string $s;
* xchan_hash of the identity in question
@@ -1380,7 +1380,7 @@ function is_foreigner($s) {
}
/**
* @brief Test whether a given identity is a member of the Red Matrix.
* @brief Test whether a given identity is a member of the Hubzilla.
*
* @param string $s;
* xchan_hash of the identity in question

View File

@@ -417,14 +417,6 @@ function post_activity_item($arr) {
$arr['item_verified'] = 1;
}
}
logger('Encrypting local storage');
$key = get_config('system','pubkey');
$arr['item_obscured'] = 1;
if($arr['title'])
$arr['title'] = json_encode(crypto_encapsulate($arr['title'],$key));
if($arr['body'])
$arr['body'] = json_encode(crypto_encapsulate($arr['body'],$key));
}
$arr['mid'] = ((x($arr,'mid')) ? $arr['mid'] : item_message_id());
@@ -560,7 +552,7 @@ function get_feed_for($channel, $observer_hash, $params) {
$atom .= replace_macros($feed_template, array(
'$version' => xmlify(RED_VERSION),
'$red' => xmlify(RED_PLATFORM),
'$red' => xmlify(PLATFORM_NAME),
'$feed_id' => xmlify($channel['xchan_url']),
'$feed_title' => xmlify($channel['channel_name']),
'$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now' , ATOM_TIME)) ,
@@ -851,7 +843,7 @@ function get_item_elements($x) {
$arr['sig'] = (($x['signature']) ? htmlspecialchars($x['signature'], ENT_COMPAT,'UTF-8',false) : '');
$arr['diaspora_meta'] = (($x['diaspora_signature']) ? json_encode(crypto_encapsulate($x['diaspora_signature'],$key)) : '');
$arr['diaspora_meta'] = (($x['diaspora_signature']) ? json_encode($x['diaspora_signature']) : '');
$arr['object'] = activity_sanitise($x['object']);
$arr['target'] = activity_sanitise($x['target']);
@@ -901,21 +893,6 @@ function get_item_elements($x) {
logger('get_item_elements: message verification failed.');
}
// if it's a private post, encrypt it in the DB.
// We have to do that here because we need to cleanse the input and prevent bad stuff from getting in,
// and we need plaintext to do that.
if(intval($arr['item_private'])) {
$arr['item_obscured'] = 1;
if($arr['title'])
$arr['title'] = json_encode(crypto_encapsulate($arr['title'],$key));
if($arr['body'])
$arr['body'] = json_encode(crypto_encapsulate($arr['body'],$key));
}
if(array_key_exists('revision',$x)) {
// extended export encoding
@@ -1179,9 +1156,15 @@ function encode_item($item,$mirror = false) {
if($item['term'])
$x['tags'] = encode_item_terms($item['term']);
if($item['diaspora_meta'])
$x['diaspora_signature'] = crypto_unencapsulate(json_decode($item['diaspora_meta'],true),$key);
if($item['diaspora_meta']) {
$z = json_decode($item['diaspora_meta'],true);
if($z) {
if(array_key_exists('iv',$z))
$x['diaspora_signature'] = crypto_unencapsulate($z,$key);
else
$x['diaspora_signature'] = $z;
}
}
logger('encode_item: ' . print_r($x,true), LOGGER_DATA);
return $x;
@@ -2034,6 +2017,7 @@ function item_store($arr, $allow_exec = false) {
$arr['deny_gid'] = ((x($arr,'deny_gid')) ? trim($arr['deny_gid']) : '');
$arr['item_private'] = ((x($arr,'item_private')) ? intval($arr['item_private']) : 0 );
$arr['item_flags'] = ((x($arr,'item_flags')) ? intval($arr['item_flags']) : 0 );
$arr['item_wall'] = ((x($arr,'item_wall')) ? intval($arr['item_wall']) : 0 );
// only detect language if we have text content, and if the post is private but not yet
// obscured, make it so.
@@ -2064,14 +2048,6 @@ function item_store($arr, $allow_exec = false) {
}
$arr = $translate['item'];
}
if($arr['item_private']) {
$key = get_config('system','pubkey');
$arr['item_obscured'] = 1;
if($arr['title'])
$arr['title'] = json_encode(crypto_encapsulate($arr['title'],$key));
if($arr['body'])
$arr['body'] = json_encode(crypto_encapsulate($arr['body'],$key));
}
}
if((x($arr,'object')) && is_array($arr['object'])) {
@@ -2208,7 +2184,6 @@ function item_store($arr, $allow_exec = false) {
if(intval($r[0]['item_wall']))
$arr['item_wall'] = 1;
// An uplinked comment might arrive with a downstream owner.
// Fix it.
@@ -2456,14 +2431,6 @@ function item_store_update($arr,$allow_exec = false) {
}
$arr = $translate['item'];
}
if($arr['item_private']) {
$key = get_config('system','pubkey');
$arr['item_obscured'] = 1;
if($arr['title'])
$arr['title'] = json_encode(crypto_encapsulate($arr['title'],$key));
if($arr['body'])
$arr['body'] = json_encode(crypto_encapsulate($arr['body'],$key));
}
}
if((x($arr,'object')) && is_array($arr['object'])) {
@@ -2636,11 +2603,10 @@ function store_diaspora_comment_sig($datarray, $channel, $parent_item, $post_id,
$x = array('signer' => $diaspora_handle, 'body' => $signed_body, 'signed_text' => $signed_text, 'signature' => base64_encode($authorsig));
$key = get_config('system','pubkey');
$y = crypto_encapsulate(json_encode($x),$key);
$y = json_encode($x);
$r = q("update item set diaspora_meta = '%s' where id = %d",
dbesc(json_encode($y)),
dbesc($y),
intval($post_id)
);
@@ -2994,6 +2960,7 @@ function tag_deliver($uid, $item_id) {
// prevent delivery looping - only proceed
// if the message originated elsewhere and is a top-level post
if(intval($item['item_wall']) || intval($item['item_origin']) || (! intval($item['item_thread_top'])) || ($item['id'] != $item['parent'])) {
logger('tag_deliver: item was local or a comment. rejected.');
return;
@@ -3158,18 +3125,8 @@ function start_delivery_chain($channel, $item, $item_id, $parent) {
$title = $item['title'];
$body = $item['body'];
if($private) {
if(! intval($item['item_obscured'])) {
$key = get_config('system','pubkey');
if($title)
$title = json_encode(crypto_encapsulate($title,$key));
if($body)
$body = json_encode(crypto_encapsulate($body,$key));
$item_obscured = 1;
}
}
else {
if(intval($item['item_obscured'])) {
if(! $private) {
if($flag_bits & ITEM_OBSCURED) {
$key = get_config('system','prvkey');
if($title)
$title = crypto_unencapsulate(json_decode($title,true),$key);

View File

@@ -159,12 +159,25 @@ function t($s, $ctx = '') {
if (x($a->strings, $cs)) {
$t = $a->strings[$cs];
return is_array($t) ? $t[0] : $t;
return ((is_array($t)) ? translate_projectname($t[0]) : translate_projectname($t));
}
return $s;
return translate_projectname($s);
}
/**
* @brief translate product name
* Merging strings from different project names is problematic so we'll do that with a string replacement
*/
function translate_projectname($s) {
return str_replace(array('$projectname','$Projectname'),array(PLATFORM_NAME,ucfirst(PLATFORM_NAME)),$s);
}
/**
* @brief
*

View File

@@ -24,26 +24,47 @@ function menu_fetch($name,$uid,$observer_xchan) {
return null;
}
function menu_render($menu, $class='', $edit = false) {
function menu_render($menu, $class='', $edit = false, $var = '') {
if(! $menu)
return '';
$channel_id = ((is_array(get_app()->profile)) ? get_app()->profile['profile_uid'] : 0);
$menu_list = menu_list($channel_id);
foreach($menu_list as $menus) {
if($menus['menu_name'] != $menu['menu']['menu_name'])
$menu_names[] = $menus['menu_name'];
}
for($x = 0; $x < count($menu['items']); $x ++) {
if(in_array($menu['items'][$x]['mitem_link'], $menu_names)) {
$m = menu_fetch($menu['items'][$x]['mitem_link'], $channel_id, get_observer_hash());
$submenu = menu_render($m, 'dropdown-menu', $edit = false, $var = array('wrap' => 'none'));
$menu['items'][$x]['submenu'] = $submenu;
}
if($menu['items'][$x]['mitem_flags'] & MENU_ITEM_ZID)
$menu['items'][$x]['mitem_link'] = zid($menu['items'][$x]['mitem_link']);
if($menu['items'][$x]['mitem_flags'] & MENU_ITEM_NEWWIN)
$menu['items'][$x]['newwin'] = '1';
$menu['items'][$x]['mitem_desc'] = bbcode($menu['items'][$x]['mitem_desc']);
}
return replace_macros(get_markup_template('usermenu.tpl'),array(
$wrap = (($var['wrap'] === 'none') ? false : true);
$ret = replace_macros(get_markup_template('usermenu.tpl'),array(
'$menu' => $menu['menu'],
'$class' => $class,
'$edit' => (($edit) ? t("Edit") : ''),
'$id' => $menu['menu']['menu_id'],
'$items' => $menu['items']
'$items' => $menu['items'],
'$wrap' => $wrap
));
return $ret;
}

View File

@@ -124,7 +124,7 @@ EOT;
if($observer) {
$userinfo = array(
'icon' => $observer['xchan_photo_s'],
'icon' => $observer['xchan_photo_m'],
'name' => $observer['xchan_addr'],
);
}

View File

@@ -603,7 +603,7 @@ function scale_external_images($s, $include_link = true, $scale_replace = false)
$scaled = str_replace($scale_replace[0], $scale_replace[1], $mtch[3]);
else
$scaled = $mtch[3];
$i = z_fetch_url($scaled);
$i = z_fetch_url($scaled,true);
$cache = get_config('system','itemcache');
@@ -613,7 +613,10 @@ function scale_external_images($s, $include_link = true, $scale_replace = false)
}
// 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);

View File

@@ -222,7 +222,6 @@ function photo_upload($channel, $observer, $args) {
}
}
$title = '';
$mid = item_message_id();

View File

@@ -1,7 +1,7 @@
<?php
/**
* @file include/reddav.php
* @brief some DAV related functions for RedMatrix.
* @brief some DAV related functions for Hubzilla.
*
* This file contains some functions which did not fit into one of the RedDAV
* classes.
@@ -19,7 +19,7 @@
*/
use Sabre\DAV;
use RedMatrix\RedDAV;
use Hubzilla\RedDAV;
require_once('vendor/autoload.php');
require_once('include/attach.php');

View File

@@ -513,9 +513,9 @@ function attribute_contains($attr, $s) {
}
/**
* @brief Logging function for RedMatrix.
* @brief Logging function for Hubzilla.
*
* Logging output is configured through RedMatrix's system config. The log file
* Logging output is configured through Hubzilla's system config. The log file
* is set in system logfile, log level in system loglevel and to enable logging
* set system debugging.
*
@@ -681,7 +681,7 @@ function get_tags($s) {
// make sure the longer tags are returned first so that if two or more have common substrings
// we'll replace the longest ones first. Otherwise the common substring would be found in
// both strings and the string replacement would link both to the shorter strings and
// fail to link the longer string. RedMatrix github issue #378
// fail to link the longer string. Hubzilla github issue #378
usort($ret,'tag_sort_length');
@@ -1379,15 +1379,15 @@ function generate_named_map($location) {
function prepare_body(&$item,$attach = false) {
if(get_config('system','item_cache') && $item['html'])
return $item['html'];
if($item['html'])
return bb_observer($item['html']);
call_hooks('prepare_body_init', $item);
unobscure($item);
$s = prepare_text($item['body'],$item['mimetype']);
$s = prepare_text($item['body'],$item['mimetype'], true);
$prep_arr = array('item' => $item, 'html' => $s);
call_hooks('prepare_body', $prep_arr);
@@ -1452,11 +1452,11 @@ function prepare_body(&$item,$attach = false) {
$prep_arr = array('item' => $item, 'html' => $s);
call_hooks('prepare_body_final', $prep_arr);
if(get_config('system','item_cache'))
q("update item set html = '%s' where id = %d",
dbesc($prep_arr['html']),
intval($item['id'])
);
q("update item set html = '%s' where id = %d",
dbesc($prep_arr['html']),
intval($item['id'])
);
return $prep_arr['html'];
}
@@ -1468,7 +1468,7 @@ function prepare_body(&$item,$attach = false) {
* @param sting $content_type
* @return string
*/
function prepare_text($text, $content_type = 'text/bbcode') {
function prepare_text($text, $content_type = 'text/bbcode', $cache = false) {
switch($content_type) {
case 'text/plain':
@@ -1506,9 +1506,9 @@ function prepare_text($text, $content_type = 'text/bbcode') {
require_once('include/bbcode.php');
if(stristr($text,'[nosmile]'))
$s = bbcode($text);
$s = bbcode($text,false,true,$cache);
else
$s = smilies(bbcode($text));
$s = smilies(bbcode($text,false,true,$cache));
$s = zidify_links($s);
break;
}
@@ -2244,7 +2244,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag, $d
// The '=' is needed to not replace color codes if the code is also used as a tag
// Much better would be to somehow completely avoiding things in e.g. [color]-tags.
// This would allow writing things like "my favourite tag=#foobar".
$body = preg_replace('/(?<![a-zA-Z0-9=])'.preg_quote($tag).'/', $newtag, $body);
$body = preg_replace('/(?<![a-zA-Z0-9=])'.preg_quote($tag,'/').'/', $newtag, $body);
$replaced = true;
}
//is the link already in str_tags?

View File

@@ -1,7 +1,7 @@
<?php
/**
* @file include/zot.php
* @brief RedMatrix implementation of zot protocol.
* @brief Hubzilla implementation of zot protocol.
*
* https://github.com/friendica/red/wiki/zot
* https://github.com/friendica/red/wiki/Zot---A-High-Level-Overview