aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorjeroenpraat <jeroenpraat@xs4all.nl>2016-12-19 16:52:17 +0100
committerjeroenpraat <jeroenpraat@xs4all.nl>2016-12-19 16:52:17 +0100
commit468fb3c77a60fe38a021502bce5ca6a4e4c211a4 (patch)
tree0a6c99558d6815157a41d46ae8e50ecb0899e527 /include
parent3a4bd27333a90191868393f747fad662a51753f0 (diff)
parent3ad3d3037f8ba9643952bbf64e70c5edf302a73b (diff)
downloadvolse-hubzilla-468fb3c77a60fe38a021502bce5ca6a4e4c211a4.tar.gz
volse-hubzilla-468fb3c77a60fe38a021502bce5ca6a4e4c211a4.tar.bz2
volse-hubzilla-468fb3c77a60fe38a021502bce5ca6a4e4c211a4.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev
Diffstat (limited to 'include')
-rw-r--r--include/bbcode.php18
-rw-r--r--include/conversation.php166
-rwxr-xr-xinclude/dba/dba_driver.php2
-rw-r--r--include/html2plain.php2
-rw-r--r--include/network.php10
5 files changed, 181 insertions, 17 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index b315255f5..32354aeda 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -1067,15 +1067,15 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
$Text = preg_replace("/\[zaudio\](.*?)\[\/zaudio\]/", '<a class="zid" href="$1" target="_blank" >$1</a>', $Text);
}
- if ($tryoembed){
- if (strpos($Text,'[/iframe]') !== false) {
- $Text = preg_replace_callback("/\[iframe\](.*?)\[\/iframe\]/ism", 'bb_iframe', $Text);
- }
- } else {
- if (strpos($Text,'[/iframe]') !== false) {
- $Text = preg_replace("/\[iframe\](.*?)\[\/iframe\]/ism", '<a href="$1" target="_blank" >$1</a>', $Text);
- }
- }
+// if ($tryoembed){
+// if (strpos($Text,'[/iframe]') !== false) {
+// $Text = preg_replace_callback("/\[iframe\](.*?)\[\/iframe\]/ism", 'bb_iframe', $Text);
+// }
+// } else {
+// if (strpos($Text,'[/iframe]') !== false) {
+// $Text = preg_replace("/\[iframe\](.*?)\[\/iframe\]/ism", '<a href="$1" target="_blank" >$1</a>', $Text);
+// }
+// }
// oembed tag
$Text = oembed_bbcode2html($Text);
diff --git a/include/conversation.php b/include/conversation.php
index d367c27a6..af64fbb90 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -689,7 +689,8 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
'id' => (($preview) ? 'P0' : $item['item_id']),
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, $profile_url),
'profile_url' => $profile_link,
- 'item_photo_menu' => item_photo_menu($item),
+ 'thread_action_menu' => thread_action_menu($item,$mode),
+ 'thread_author_menu' => thread_author_menu($item,$mode),
'name' => $profile_name,
'sparkle' => $sparkle,
'lock' => $lock,
@@ -960,6 +961,169 @@ function item_photo_menu($item){
return $o;
}
+
+function thread_action_menu($item,$mode = '') {
+
+ $menu = [];
+
+ if((local_channel()) && local_channel() == $item['uid']) {
+ $menu[] = [
+ 'menu' => 'view_source',
+ 'title' => t('View Source'),
+ 'icon' => 'eye',
+ 'action' => 'viewsrc(' . $item['id'] . '); return false;',
+ 'href' => '#'
+ ];
+
+ if(! in_array($mode, [ 'network-new', 'search', 'community'])) {
+ if($item['parent'] == $item['id'] && (get_observer_hash() != $item['author_xchan'])) {
+ $menu[] = [
+ 'menu' => 'follow_thread',
+ 'title' => t('Follow Thread'),
+ 'icon' => 'plus',
+ 'action' => 'dosubthread(' . $item['id'] . '); return false;',
+ 'href' => '#'
+ ];
+ }
+
+ $menu[] = [
+ 'menu' => 'unfollow_thread',
+ 'title' => t('Unfollow Thread'),
+ 'icon' => 'minus',
+ 'action' => 'dounsubthread(' . $item['id'] . '); return false;',
+ 'href' => '#'
+ ];
+ }
+
+ }
+
+
+
+
+ $args = [ 'item' => $item, 'mode' => $mode, 'menu' => $menu ];
+ call_hooks('thread_action_menu', $args);
+
+ return $args['menu'];
+
+}
+
+function thread_author_menu($item, $mode = '') {
+
+ $menu = [];
+
+ $local_channel = local_channel();
+
+ if($local_channel) {
+ if(! count(App::$contacts))
+ load_contact_links($local_channel);
+ $channel = App::get_channel();
+ $channel_hash = (($channel) ? $channel['channel_hash'] : '');
+ }
+
+ $profile_link = chanlink_hash($item['author_xchan']);
+ if($item['uid'] > 0)
+ $pm_url = z_root() . '/mail/new/?f=&hash=' . $item['author_xchan'];
+
+ if(App::$contacts && array_key_exists($item['author_xchan'],App::$contacts))
+ $contact = App::$contacts[$item['author_xchan']];
+ else
+ if($local_channel && $item['author']['xchan_addr'])
+ $follow_url = z_root() . '/follow/?f=&url=' . $item['author']['xchan_addr'];
+
+ if($contact) {
+ $poke_link = z_root() . '/poke/?f=&c=' . $contact['abook_id'];
+ if (! intval($contact['abook_self']))
+ $contact_url = z_root() . '/connedit/' . $contact['abook_id'];
+ $posts_link = z_root() . '/network/?cid=' . $contact['abook_id'];
+
+ $clean_url = normalise_link($item['author-link']);
+ }
+
+ $rating_enabled = get_config('system','rating_enabled');
+
+ $ratings_url = (($rating_enabled) ? z_root() . '/ratings/' . urlencode($item['author_xchan']) : '');
+
+ if($profile_link) {
+ $menu[] = [
+ 'menu' => 'view_profile',
+ 'title' => t('View Profile'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $profile_link
+ ];
+ }
+
+ if($posts_link) {
+ $menu[] = [
+ 'menu' => 'view_posts',
+ 'title' => t('Activity/Posts'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $posts_link
+ ];
+ }
+
+ if($follow_url) {
+ $menu[] = [
+ 'menu' => 'follow',
+ 'title' => t('Connect'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $follow_url
+ ];
+ }
+
+ if($contact_url) {
+ $menu[] = [
+ 'menu' => 'connedit',
+ 'title' => t('Edit Connection'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $contact_url
+ ];
+ }
+
+ if($pm_url) {
+ $menu[] = [
+ 'menu' => 'prv_message',
+ 'title' => t('Message'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $pm_url
+ ];
+ }
+
+ if($ratings_url) {
+ $menu[] = [
+ 'menu' => 'ratings',
+ 'title' => t('Ratings'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $ratings_url
+ ];
+ }
+
+ if($poke_link) {
+ $menu[] = [
+ 'menu' => 'poke',
+ 'title' => t('Poke'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $poke_link
+ ];
+ }
+
+ $args = [ 'item' => $item, 'mode' => $mode, 'menu' => $menu ];
+ call_hooks('thread_author_menu', $args);
+
+ return $args['menu'];
+
+}
+
+
+
+
+
/**
* @brief Checks item to see if it is one of the builtin activities (like/dislike, event attendance, consensus items, etc.)
*
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index 81a3bd590..e47f97387 100755
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -337,7 +337,7 @@ function db_concat($fld, $sep) {
function q($sql) {
$args = func_get_args();
- unset($args[0]);
+ array_shift($args);
if(\DBA::$dba && \DBA::$dba->connected) {
$stmt = vsprintf($sql, $args);
diff --git a/include/html2plain.php b/include/html2plain.php
index 2f5be7f69..979354079 100644
--- a/include/html2plain.php
+++ b/include/html2plain.php
@@ -113,7 +113,7 @@ function html2plain($html, $wraplength = 75, $compact = false)
$xpath = new DomXPath($doc);
$list = $xpath->query("//pre");
foreach ($list as $node) {
- $node->nodeValue = str_replace("\n", "\r", $node->nodeValue);
+ $node->nodeValue = str_replace("\n", "\r", htmlspecialchars($node->nodeValue));
}
$message = $doc->saveHTML();
diff --git a/include/network.php b/include/network.php
index fe360c425..451ce12a1 100644
--- a/include/network.php
+++ b/include/network.php
@@ -59,7 +59,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
if(x($opts,'filep')) {
@curl_setopt($ch, CURLOPT_FILE, $opts['filep']);
- @curl_setopt($ch, CURLOPT_HEADER, $false);
+ @curl_setopt($ch, CURLOPT_HEADER, false);
}
if(x($opts,'upload'))
@@ -87,7 +87,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
@curl_setopt($ch, CURLOPT_TIMEOUT, $opts['timeout']);
}
else {
- $curl_time = intval(get_config('system','curl_timeout'));
+ $curl_time = intval(@get_config('system','curl_timeout'));
@curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
}
@@ -107,7 +107,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,
((x($opts,'novalidate') && intval($opts['novalidate'])) ? false : true));
- $prx = get_config('system','proxy');
+ $prx = @get_config('system','proxy');
if(strlen($prx)) {
@curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
@curl_setopt($ch, CURLOPT_PROXY, $prx);
@@ -226,7 +226,7 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) {
if(x($opts,'filep')) {
@curl_setopt($ch, CURLOPT_FILE, $opts['filep']);
- @curl_setopt($ch, CURLOPT_HEADER, $false);
+ @curl_setopt($ch, CURLOPT_HEADER, false);
}
if(x($opts,'headers')) {
@@ -246,7 +246,7 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) {
@curl_setopt($ch, CURLOPT_TIMEOUT, $opts['timeout']);
}
else {
- $curl_time = intval(get_config('system','curl_timeout'));
+ $curl_time = intval(@get_config('system','curl_timeout'));
@curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
}