aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-05-14 18:02:29 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-05-14 18:02:29 -0700
commita6cb90c81c29663e96d4fd96acd43fde1c28ac15 (patch)
tree24d116fb5fe6b1e2687f833cee9685d6480a95eb /include
parentb467dc4f0055452b65fac842d1294ec9cc978445 (diff)
parent51b89f0ed8833004cf695de90791d8d0eec550b5 (diff)
downloadvolse-hubzilla-a6cb90c81c29663e96d4fd96acd43fde1c28ac15.tar.gz
volse-hubzilla-a6cb90c81c29663e96d4fd96acd43fde1c28ac15.tar.bz2
volse-hubzilla-a6cb90c81c29663e96d4fd96acd43fde1c28ac15.zip
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
Diffstat (limited to 'include')
-rw-r--r--include/Import/Importer.php4
-rw-r--r--include/Import/refimport.php7
-rw-r--r--include/RedDAV/RedBasicAuth.php2
-rw-r--r--include/RedDAV/RedBrowser.php2
-rw-r--r--include/RedDAV/RedDirectory.php2
-rw-r--r--include/RedDAV/RedFile.php4
-rw-r--r--include/activities.php2
-rw-r--r--include/api.php4
-rw-r--r--include/bb2diaspora.php2
-rw-r--r--include/bbcode.php48
-rw-r--r--include/comanche.php70
-rwxr-xr-xinclude/diaspora.php29
-rw-r--r--include/enotify.php4
-rw-r--r--include/event.php2
-rw-r--r--include/identity.php6
-rwxr-xr-xinclude/items.php77
-rw-r--r--include/language.php17
-rw-r--r--include/menu.php27
-rw-r--r--include/nav.php2
-rw-r--r--include/network.php5
-rw-r--r--include/photos.php1
-rw-r--r--include/reddav.php4
-rw-r--r--include/text.php30
-rw-r--r--include/zot.php2
24 files changed, 234 insertions, 119 deletions
diff --git a/include/Import/Importer.php b/include/Import/Importer.php
index 5e684cd8e..cddfac7b5 100644
--- a/include/Import/Importer.php
+++ b/include/Import/Importer.php
@@ -1,11 +1,11 @@
<?php /** @file */
-namespace RedMatrix\Import;
+namespace Hubzilla\Import;
/**
* @brief Class Import
*
- * @package RedMatrix\Import
+ * @package Hubzilla\Import
*/
class Import {
diff --git a/include/Import/refimport.php b/include/Import/refimport.php
index 9b9b04bc7..7d32e143f 100644
--- a/include/Import/refimport.php
+++ b/include/Import/refimport.php
@@ -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';
diff --git a/include/RedDAV/RedBasicAuth.php b/include/RedDAV/RedBasicAuth.php
index 19dd9a5f0..3c944a22d 100644
--- a/include/RedDAV/RedBasicAuth.php
+++ b/include/RedDAV/RedBasicAuth.php
@@ -1,6 +1,6 @@
<?php
-namespace RedMatrix\RedDAV;
+namespace Hubzilla\RedDAV;
use Sabre\DAV;
diff --git a/include/RedDAV/RedBrowser.php b/include/RedDAV/RedBrowser.php
index a0330d7cc..40d1ce0a1 100644
--- a/include/RedDAV/RedBrowser.php
+++ b/include/RedDAV/RedBrowser.php
@@ -1,6 +1,6 @@
<?php
-namespace RedMatrix\RedDAV;
+namespace Hubzilla\RedDAV;
use Sabre\DAV;
diff --git a/include/RedDAV/RedDirectory.php b/include/RedDAV/RedDirectory.php
index 922be378d..229e25835 100644
--- a/include/RedDAV/RedDirectory.php
+++ b/include/RedDAV/RedDirectory.php
@@ -1,6 +1,6 @@
<?php
-namespace RedMatrix\RedDAV;
+namespace Hubzilla\RedDAV;
use Sabre\DAV;
diff --git a/include/RedDAV/RedFile.php b/include/RedDAV/RedFile.php
index b7aa5473a..d15bfeb8e 100644
--- a/include/RedDAV/RedFile.php
+++ b/include/RedDAV/RedFile.php
@@ -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;
/**
diff --git a/include/activities.php b/include/activities.php
index 0ea303d65..df43f1f6f 100644
--- a/include/activities.php
+++ b/include/activities.php
@@ -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;
diff --git a/include/api.php b/include/api.php
index bc1fa53b9..01518bea8 100644
--- a/include/api.php
+++ b/include/api.php
@@ -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
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index 74ef368cf..ed8625899 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -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";
diff --git a/include/bbcode.php b/include/bbcode.php
index fe5f37260..49dd4752d 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -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();
diff --git a/include/comanche.php b/include/comanche.php
index c1a98ed6c..3030ae5c6 100644
--- a/include/comanche.php
+++ b/include/comanche.php
@@ -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);
diff --git a/include/diaspora.php b/include/diaspora.php
index 26f0dc70f..43eed003e 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -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')
));
}
diff --git a/include/enotify.php b/include/enotify.php
index 06e9aad37..b34d7fdd7 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -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');
diff --git a/include/event.php b/include/event.php
index 498297157..0d8b2132b 100644
--- a/include/event.php
+++ b/include/event.php
@@ -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 {
diff --git a/include/identity.php b/include/identity.php
index 16127f7d0..6a2b66dda 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -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
diff --git a/include/items.php b/include/items.php
index 98596cede..2bb6c1012 100755
--- a/include/items.php
+++ b/include/items.php
@@ -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);
diff --git a/include/language.php b/include/language.php
index 1e8528dc1..7dbe3dd02 100644
--- a/include/language.php
+++ b/include/language.php
@@ -159,13 +159,26 @@ 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
*
* @param string $singular
diff --git a/include/menu.php b/include/menu.php
index b4f4555a5..5c0811437 100644
--- a/include/menu.php
+++ b/include/menu.php
@@ -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;
}
diff --git a/include/nav.php b/include/nav.php
index 1134d1b48..77287c021 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -124,7 +124,7 @@ EOT;
if($observer) {
$userinfo = array(
- 'icon' => $observer['xchan_photo_s'],
+ 'icon' => $observer['xchan_photo_m'],
'name' => $observer['xchan_addr'],
);
}
diff --git a/include/network.php b/include/network.php
index 0ee7f044f..fb336fbb4 100644
--- a/include/network.php
+++ b/include/network.php
@@ -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);
diff --git a/include/photos.php b/include/photos.php
index 29e2f32e2..badf7cb10 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -222,7 +222,6 @@ function photo_upload($channel, $observer, $args) {
}
}
-
$title = '';
$mid = item_message_id();
diff --git a/include/reddav.php b/include/reddav.php
index 750ca1b24..c39f08f4d 100644
--- a/include/reddav.php
+++ b/include/reddav.php
@@ -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');
diff --git a/include/text.php b/include/text.php
index 72000b546..bb704e35c 100644
--- a/include/text.php
+++ b/include/text.php
@@ -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?
diff --git a/include/zot.php b/include/zot.php
index 2111b33a6..b9a06cdee 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -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