aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/Hubzilla_on_OpenShift.bb4
-rw-r--r--include/api.php7
-rw-r--r--include/bb2diaspora.php5
-rwxr-xr-xinclude/items.php2
-rw-r--r--include/photo/photo_driver.php15
-rw-r--r--include/photos.php14
-rw-r--r--include/text.php11
-rw-r--r--mod/connedit.php24
-rw-r--r--mod/editpost.php1
-rw-r--r--mod/item.php4
-rwxr-xr-xutil/service_class14
-rw-r--r--version.inc2
-rwxr-xr-xview/tpl/abook_edit.tpl7
13 files changed, 84 insertions, 26 deletions
diff --git a/doc/Hubzilla_on_OpenShift.bb b/doc/Hubzilla_on_OpenShift.bb
index db61c3a48..9b2c539dc 100644
--- a/doc/Hubzilla_on_OpenShift.bb
+++ b/doc/Hubzilla_on_OpenShift.bb
@@ -1,7 +1,9 @@
[b]Hubzilla on OpenShift[/b]
You will notice a new .openshift folder when you fetch from upstream, i.e. from [url=https://github.com/redmatrix/hubzilla.git]https://github.com/redmatrix/hubzilla.git[/url] , which contains a deploy script to set up Hubzilla on OpenShift with plugins and extra themes.
-Create an account on OpenShift, then use the registration e-mail and password to create your first Hubzilla instance. Install git and RedHat's command line tools - rhc - if you have not already done so.
+As of this writing, 2015-10-28, you do not have to pay for OpenShift on the Free plan, which gives you three gears at no cost. The Bronze plan gives you three gears at no cost too, but you can expand to 16 gears by paying, and this requires you to register your payment card. The three gears can give three instances of Hubzilla with one gear each, or you can combine two gears into one high-availability Hubzilla instance and one extra gear. The main difference to be aware of is this: gears on the Free plan will go into hibernation if left idle for too long, this does not happen on the Bronze plan.
+
+Create an account on OpenShift, then use the registration e-mail and password to create your first Hubzilla instance. Install git and RedHat's command line tools - rhc - if you have not already done so. See for example https://developers.openshift.com/en/getting-started-debian-ubuntu.html on how to do this on Debian GNU/Linux, or in the menu on that page for other GNU/Linux distributions or other operating systems.
[code]rhc app-create your_app_name php-5.4 mysql-5.5 cron phpmyadmin --namespace your_domain --from-code https://github.com/redmatrix/hubzilla.git -l your@email.address -p your_account_password
[/code]
diff --git a/include/api.php b/include/api.php
index 16dbb569b..ad29625d8 100644
--- a/include/api.php
+++ b/include/api.php
@@ -75,8 +75,9 @@ require_once('include/attach.php');
try {
$oauth = new FKOAuth1();
$req = OAuthRequest::from_request();
+
list($consumer,$token) = $oauth->verify_request($req);
-// list($consumer,$token) = $oauth->verify_request(OAuthRequest::from_request());
+
if (!is_null($token)){
$oauth->loginUser($token->uid);
@@ -826,6 +827,7 @@ require_once('include/attach.php');
require_once('include/html2bbcode.php');
$txt = requestdata('htmlstatus');
+
if((strpos($txt,'<') !== false) || (strpos($txt,'>') !== false)) {
$txt = html2bb_video($txt);
@@ -837,9 +839,10 @@ require_once('include/attach.php');
$purifier = new HTMLPurifier($config);
$txt = $purifier->purify($txt);
- $_REQUEST['body'] = html2bbcode($txt);
}
+ $_REQUEST['body'] = html2bbcode($txt);
+
}
else
$_REQUEST['body'] = requestdata('status');
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index d10ed57eb..7cba40672 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -309,9 +309,8 @@ function bb2diaspora_itembody($item, $force_update = false) {
$is_photo = (($item['obj_type'] == ACTIVITY_OBJ_PHOTO) ? true : false);
if($is_photo) {
$object = json_decode($item['object'],true);
- if($object['link'][2]) {
- $photo_bb = '[zrl=' . rawurldecode($object['id']) . ']' . '[zmg=' . $object['link'][2]['width'] . 'x' . $object['link'][2]['height'] . ']' . rawurldecode($object['link'][2]['href']) . '[/zmg]' . '[/zrl]';
- $item['body'] = (($item['body']) ? $photo_bb . $item['body'] : $photo_bb);
+ if($object['bbcode']) {
+ $item['body'] = (($item['body']) ? $object['bbcode'] . "\r\n" . $item['body'] : $object['bbcode']);
}
}
diff --git a/include/items.php b/include/items.php
index 08be981e7..ce8e2b9b0 100755
--- a/include/items.php
+++ b/include/items.php
@@ -4792,7 +4792,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
if($arr['mid'])
$sql_options .= " and parent_mid = '" . dbesc($arr['mid']) . "' ";
- $sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE item_thread_top = 1 $sql_options ) ";
+ $sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE item_thread_top = 1 $sql_options $item_normal ) ";
if($arr['since_id'])
$sql_extra .= " and item.id > " . $since_id . " ";
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php
index 32b9bd302..e980a96e1 100644
--- a/include/photo/photo_driver.php
+++ b/include/photo/photo_driver.php
@@ -546,11 +546,18 @@ function guess_image_type($filename, $headers = '') {
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$ph = photo_factory('');
$types = $ph->supportedTypes();
- $type = "image/jpeg";
foreach ($types as $m=>$e){
if ($ext==$e) $type = $m;
}
}
+
+ if(is_null($type)) {
+ $size = getimagesize($filename);
+ $ph = photo_factory('');
+ $types = $ph->supportedTypes();
+ $type = ((array_key_exists($size['mime'], $types)) ? $size['mime'] : 'image/jpeg');
+ }
+
}
logger('Photo: guess_image_type: type='.$type, LOGGER_DEBUG);
return $type;
@@ -586,16 +593,12 @@ function import_xchan_photo($photo,$xchan,$thing = false) {
if($photo) {
$filename = basename($photo);
- $type = guess_image_type($photo);
-
- if(! $type)
- $type = 'image/jpeg';
-
$result = z_fetch_url($photo,true);
if($result['success']) {
$img_str = $result['body'];
+ $type = guess_image_type($photo, $result['header']);
$h = explode("\n",$result['header']);
if($h) {
diff --git a/include/photos.php b/include/photos.php
index d62d5aeb8..c7360a956 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -379,6 +379,20 @@ function photo_upload($channel, $observer, $args) {
$arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $arr['mid'];
$arr['body'] = (($object) ? $args['body'] : $body . "\r\n" . $args['body']);
+
+ // this one is tricky because the item and the photo have the same permissions, those of the photo.
+ // Use the channel read_stream permissions to get the correct public_policy for the item and recalculate the
+ // private flag accordingly. This may cause subtle bugs due to custom permissions roles. We want to use
+ // public policy when federating items to other sites, but should probably ignore them when accessing the item
+ // in the photos pages - using the photos permissions instead. We need the public policy to keep the photo
+ // linked item from leaking into the feed when somebody has a channel with read_stream restrictions.
+
+ $arr['public_policy'] = map_scope($channel['channel_r_stream'],true);
+ if($arr['public_policy'])
+ $arr['item_private'] = 1;
+
+
+
$result = item_store($arr);
$item_id = $result['item_id'];
diff --git a/include/text.php b/include/text.php
index c30be77b8..5df7bb4a1 100644
--- a/include/text.php
+++ b/include/text.php
@@ -912,8 +912,17 @@ function sslify($s) {
if (strpos(z_root(),'https:') === false)
return $s;
+ // By default we'll only sslify img tags because media files will probably choke.
+ // You can set sslify_everything if you want - but it will likely white-screen if it hits your php memory limit.
+ // The downside is that http: media files will likely be blocked by your browser
+ // Complain to your browser maker
+
+ $allow = get_config('system','sslify_everything');
+
+ $pattern = (($allow) ? "/\<(.*?)src=\"(http\:.*?)\"(.*?)\>/" : "/\<img(.*?)src=\"(http\:.*?)\"(.*?)\>/" );
+
$matches = null;
- $cnt = preg_match_all("/\<(.*?)src=\"(http\:.*?)\"(.*?)\>/",$s,$matches,PREG_SET_ORDER);
+ $cnt = preg_match_all($pattern,$s,$matches,PREG_SET_ORDER);
if ($cnt) {
foreach ($matches as $match) {
$filename = basename( parse_url($match[2], PHP_URL_PATH) );
diff --git a/mod/connedit.php b/mod/connedit.php
index 65eba885a..c3fcc6d54 100644
--- a/mod/connedit.php
+++ b/mod/connedit.php
@@ -652,12 +652,30 @@ function connedit_content(&$a) {
$perms[] = array('perms_' . $k, $v[3], (($contact['abook_their_perms'] & $v[1]) ? "1" : ""),$thisperm, $v[1], (($channel[$v[0]] == PERMS_SPECIFIC) ? '' : '1'), $v[4], $checkinherited);
}
+ $locstr = '';
+
+ $locs = q("select hubloc_addr as location from hubloc where hubloc_hash = '%s'",
+ dbesc($contact['xchan_hash'])
+ );
+
+ if($locs) {
+ foreach($locs as $l) {
+ if(strlen($locstr))
+ $locstr .= ', ';
+ $locstr .= $l['location'];
+ }
+ }
+ else
+ $locstr = t('none');
+
$o .= replace_macros($tpl,array(
'$header' => (($self) ? t('Connection Default Permissions') : sprintf( t('Connection: %s'),$contact['xchan_name'])),
'$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), 'Connection requests will be approved without your interaction', array(t('No'),('Yes'))),
'$addr' => $contact['xchan_addr'],
- '$addr_text' => t('This connection\'s address is'),
+ '$addr_text' => t('This connection\'s primary address is'),
+ '$loc_text' => t('Available locations:'),
+ '$locstr' => $locstr,
'$notself' => (($self) ? '' : '1'),
'$self' => (($self) ? '1' : ''),
'$autolbl' => t('The permissions indicated on this page will be applied to all new connections.'),
@@ -668,8 +686,8 @@ function connedit_content(&$a) {
'$lbl_rating_txt' => t('Optionally explain your rating'),
'$connfilter' => feature_enabled(local_channel(),'connfilter'),
'$connfilter_label' => t('Custom Filter'),
- '$incl' => array('abook_incl',t('Only import posts with this text'), $contact['abook_incl'],t('words one per line or #tags or /patterns/, leave blank to import all posts')),
- '$excl' => array('abook_excl',t('Do not import posts with this text'), $contact['abook_excl'],t('words one per line or #tags or /patterns/, leave blank to import all posts')),
+ '$incl' => array('abook_incl',t('Only import posts with this text'), $contact['abook_incl'],t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts')),
+ '$excl' => array('abook_excl',t('Do not import posts with this text'), $contact['abook_excl'],t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts')),
'$rating_text' => array('rating_text', t('Optionally explain your rating'),$rating_text,''),
'$rating_info' => t('This information is public!'),
'$rating' => $rating,
diff --git a/mod/editpost.php b/mod/editpost.php
index 1bee16ee7..2f999858f 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -90,7 +90,6 @@ function editpost_content(&$a) {
$category .= ', ';
$category .= $cat['term'];
}
-
}
if($itm[0]['attach']) {
diff --git a/mod/item.php b/mod/item.php
index 4dcf8edd7..591dc8407 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -607,6 +607,7 @@ function item_post(&$a) {
if(preg_match_all('/(\[attachment\](.*?)\[\/attachment\])/',$body,$match)) {
$attachments = array();
+ $i = 0;
foreach($match[2] as $mtch) {
$attach_link = '';
$hash = substr($mtch,0,strpos($mtch,','));
@@ -626,7 +627,8 @@ function item_post(&$a) {
$attach_link = '[audio]' . z_root() . '/attach/' . $r['data']['hash'] . '/' . $r['data']['revision'] . (($ext) ? $ext : '') . '[/audio]';
elseif(strpos($r['data']['filetype'],'video/') !== false)
$attach_link = '[video]' . z_root() . '/attach/' . $r['data']['hash'] . '/' . $r['data']['revision'] . (($ext) ? $ext : '') . '[/video]';
- $body = str_replace($match[1],$attach_link,$body);
+ $body = str_replace($match[1][$i],$attach_link,$body);
+ $i++;
}
}
diff --git a/util/service_class b/util/service_class
index a1a172518..d3b60a2df 100755
--- a/util/service_class
+++ b/util/service_class
@@ -90,11 +90,15 @@ if($argc == 2) {
if($argc == 1) {
load_config('service_class');
- foreach($a->config['service_class'] as $class=>$props) {
- echo "$class:\n";
- $d = unserialize($props);
- foreach($d as $k => $v) {
- echo "\t$k = $v\n";
+ if(is_array($a->config['service_class']) && $a->config['service_class']) {
+ foreach($a->config['service_class'] as $class=>$props) {
+ echo "$class:\n";
+ $d = unserialize($props);
+ if(is_array($d) && $d) {
+ foreach($d as $k => $v) {
+ echo "\t$k = $v\n";
+ }
+ }
}
}
} \ No newline at end of file
diff --git a/version.inc b/version.inc
index fbb404a42..89cc96160 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2015-10-27.1198
+2015-10-29.1200
diff --git a/view/tpl/abook_edit.tpl b/view/tpl/abook_edit.tpl
index 0a7cf2d4d..1ed3baafa 100755
--- a/view/tpl/abook_edit.tpl
+++ b/view/tpl/abook_edit.tpl
@@ -33,8 +33,13 @@
{{/foreach}}
<div class="section-content-info-wrapper">
<div>
- {{$addr_text}} <strong>'{{$addr}}'</strong>
+ {{$addr_text}} <strong>'{{$addr}}'</strong>
</div>
+ {{if $locstr}}
+ <div>
+ {{$loc_text}} {{$locstr}}
+ </div>
+ {{/if}}
{{if $last_update}}
<div>
{{$lastupdtext}} {{$last_update}}