aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-03-18 09:35:53 +0100
committerMario <mario@mariovavti.com>2019-03-18 09:35:53 +0100
commit51156d058232969d55032f045859e46bb3a09162 (patch)
tree4f2dea61bdc49be73de4ae00fc4e22937361df3e
parente28bde6ccdb03b370df1dbc8654d69c905b8a235 (diff)
parentea9925f489602529891c0ed468cf35117e7ef454 (diff)
downloadvolse-hubzilla-51156d058232969d55032f045859e46bb3a09162.tar.gz
volse-hubzilla-51156d058232969d55032f045859e46bb3a09162.tar.bz2
volse-hubzilla-51156d058232969d55032f045859e46bb3a09162.zip
Merge branch 'dev' into 'dev'
misc fixes See merge request hubzilla/core!1558
-rw-r--r--Zotlabs/Lib/Enotify.php24
-rw-r--r--Zotlabs/Module/Dreport.php3
-rw-r--r--Zotlabs/Module/Import.php3
-rw-r--r--Zotlabs/Module/Setup.php6
-rw-r--r--include/channel.php12
-rw-r--r--include/import.php88
-rw-r--r--include/network.php6
-rwxr-xr-xutil/service_class7
-rw-r--r--view/tpl/dreport.tpl2
9 files changed, 132 insertions, 19 deletions
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index 5e5798cac..a7082f45a 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -754,9 +754,9 @@ class Enotify {
// generate a multipart/alternative message header
$messageHeader =
$params['additionalMailHeader'] .
- "From: $fromName <{$params['fromEmail']}>\n" .
- "Reply-To: $fromName <{$params['replyTo']}>\n" .
- "MIME-Version: 1.0\n" .
+ "From: $fromName <{$params['fromEmail']}>" . PHP_EOL .
+ "Reply-To: $fromName <{$params['replyTo']}>" . PHP_EOL .
+ "MIME-Version: 1.0" . PHP_EOL .
"Content-Type: multipart/alternative; boundary=\"{$mimeBoundary}\"";
// assemble the final multipart message body with the text and html types included
@@ -764,15 +764,15 @@ class Enotify {
$htmlBody = chunk_split(base64_encode($params['htmlVersion']));
$multipartMessageBody =
- "--" . $mimeBoundary . "\n" . // plain text section
- "Content-Type: text/plain; charset=UTF-8\n" .
- "Content-Transfer-Encoding: base64\n\n" .
- $textBody . "\n" .
- "--" . $mimeBoundary . "\n" . // text/html section
- "Content-Type: text/html; charset=UTF-8\n" .
- "Content-Transfer-Encoding: base64\n\n" .
- $htmlBody . "\n" .
- "--" . $mimeBoundary . "--\n"; // message ending
+ "--" . $mimeBoundary . PHP_EOL . // plain text section
+ "Content-Type: text/plain; charset=UTF-8" . PHP_EOL .
+ "Content-Transfer-Encoding: base64" . PHP_EOL . PHP_EOL .
+ $textBody . PHP_EOL .
+ "--" . $mimeBoundary . PHP_EOL . // text/html section
+ "Content-Type: text/html; charset=UTF-8" . PHP_EOL .
+ "Content-Transfer-Encoding: base64" . PHP_EOL . PHP_EOL .
+ $htmlBody . PHP_EOL .
+ "--" . $mimeBoundary . "--" . PHP_EOL; // message ending
// send the message
$res = mail(
diff --git a/Zotlabs/Module/Dreport.php b/Zotlabs/Module/Dreport.php
index 1538ea278..0fc36dc29 100644
--- a/Zotlabs/Module/Dreport.php
+++ b/Zotlabs/Module/Dreport.php
@@ -161,7 +161,8 @@ class Dreport extends \Zotlabs\Web\Controller {
$o = replace_macros(get_markup_template('dreport.tpl'), array(
'$title' => sprintf( t('Delivery report for %1$s'),basename($mid)) . '...',
'$table' => $table,
- '$mid' => (($encoded_mid) ? $encoded_mid : $mid),
+ '$mid' => urlencode($mid),
+ '$safe_mid' => urlencode(gen_link_id($mid)),
'$options' => t('Options'),
'$push' => t('Redeliver'),
'$entries' => $entries
diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php
index 0daf28aa9..9d047ed7b 100644
--- a/Zotlabs/Module/Import.php
+++ b/Zotlabs/Module/Import.php
@@ -472,6 +472,9 @@ class Import extends \Zotlabs\Web\Controller {
if(is_array($data['app']))
import_apps($channel,$data['app']);
+ if(is_array($data['sysapp']))
+ import_sysapps($channel,$data['sysapp']);
+
if(is_array($data['chatroom']))
import_chatrooms($channel,$data['chatroom']);
diff --git a/Zotlabs/Module/Setup.php b/Zotlabs/Module/Setup.php
index ce0538099..c809ff5ec 100644
--- a/Zotlabs/Module/Setup.php
+++ b/Zotlabs/Module/Setup.php
@@ -732,6 +732,12 @@ class Setup extends \Zotlabs\Web\Controller {
// install the standard theme
set_config('system', 'allowed_themes', 'redbasic');
+ // if imagick converter is installed, use it
+ if(@is_executable('/usr/bin/convert')) {
+ set_config('system','imagick_convert_path','/usr/bin/convert');
+ }
+
+
// Set a lenient list of ciphers if using openssl. Other ssl engines
// (e.g. NSS used in RedHat) require different syntax, so hopefully
// the default curl cipher list will work for most sites. If not,
diff --git a/include/channel.php b/include/channel.php
index 7646de151..654bbdb05 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -948,6 +948,18 @@ function identity_basic_export($channel_id, $sections = null) {
}
$ret['app'] = $r;
}
+ $r = q("select * from app where app_channel = %d and app_system = 1",
+ intval($channel_id)
+ );
+ if($r) {
+ for($x = 0; $x < count($r); $x ++) {
+ $r[$x]['term'] = q("select * from term where otype = %d and oid = %d",
+ intval(TERM_OBJ_APP),
+ intval($r[$x]['id'])
+ );
+ }
+ $ret['sysapp'] = $r;
+ }
}
if(in_array('chatrooms',$sections)) {
diff --git a/include/import.php b/include/import.php
index f391400bd..8d1a19202 100644
--- a/include/import.php
+++ b/include/import.php
@@ -147,7 +147,9 @@ function import_config($channel, $configs) {
foreach($configs as $config) {
unset($config['id']);
$config['uid'] = $channel['channel_id'];
-
+ if($config['cat'] === 'system' && $config['k'] === 'import_system_apps') {
+ continue;
+ }
create_table_from_array('pconfig', $config);
}
@@ -364,6 +366,9 @@ function import_apps($channel, $apps) {
if($channel && $apps) {
foreach($apps as $app) {
+ if(array_key_exists('app_system',$app) && intval($app['app_system']))
+ continue;
+
$term = ((array_key_exists('term',$app) && is_array($app['term'])) ? $app['term'] : null);
unset($app['id']);
@@ -413,6 +418,9 @@ function sync_apps($channel, $apps) {
$exists = false;
$term = ((array_key_exists('term',$app)) ? $app['term'] : null);
+ if(array_key_exists('app_system',$app) && intval($app['app_system']))
+ continue;
+
$x = q("select * from app where app_id = '%s' and app_channel = %d limit 1",
dbesc($app['app_id']),
intval($channel['channel_id'])
@@ -504,6 +512,84 @@ function sync_apps($channel, $apps) {
}
}
+
+
+/**
+ * @brief Import system apps.
+ * System apps from the original server may not exist on this system
+ * (e.g. apps associated with addons that are not installed here).
+ * Check the system apps that were provided in the import file to see if they
+ * exist here and if so, install them locally. Preserve categories that
+ * might have been added by this channel on the other server.
+ * Do not use any paths from the original as they will point to a different server.
+ * @param array $channel
+ * @param array $apps
+ */
+function import_sysapps($channel, $apps) {
+
+ if($channel && $apps) {
+
+ $sysapps = \Zotlabs\Lib\Apps::get_system_apps(false);
+
+ foreach($apps as $app) {
+
+ if(array_key_exists('app_system',$app) && (! intval($app['app_system'])))
+ continue;
+
+ $term = ((array_key_exists('term',$app) && is_array($app['term'])) ? $app['term'] : null);
+
+ foreach($sysapps as $sysapp) {
+ if($app['app_id'] === hash('whirlpool',$sysapp['app_name'])) {
+ // install this app on this server
+ $newapp = $sysapp;
+ $newapp['uid'] = $channel['channel_id'];
+ $newapp['guid'] = hash('whirlpool',$newapp['name']);
+
+ $installed = q("select id from app where app_id = '%s' and app_channel = %d limit 1",
+ dbesc($newapp['guid']),
+ intval($channel['channel_id'])
+ );
+ if($installed) {
+ break;
+ }
+
+ $newapp['system'] = 1;
+ if($term) {
+ $s = EMPTY_STR;
+ foreach($term as $t) {
+ if($s) {
+ $s .= ',';
+ }
+ $s .= $t['term'];
+ }
+ $newapp['categories'] = $s;
+ }
+ \Zotlabs\Lib\Apps::app_install($channel['channel_id'],$newapp);
+ }
+ }
+ }
+ }
+}
+
+/**
+ * @brief Sync system apps.
+ *
+ * @param array $channel
+ * @param array $apps
+ */
+function sync_sysapps($channel, $apps) {
+
+ if($channel && $apps) {
+
+ // we do not currently sync system apps
+
+ }
+}
+
+
+
+
+
/**
* @brief Import chatrooms.
*
diff --git a/include/network.php b/include/network.php
index 3e8134a32..c754625cd 100644
--- a/include/network.php
+++ b/include/network.php
@@ -895,7 +895,7 @@ function email_header_encode($in_str, $charset = 'UTF-8', $header = 'Subject') {
// define start delimimter, end delimiter and spacer
$end = "?=";
$start = "=?" . $charset . "?B?";
- $spacer = $end . "\r\n " . $start;
+ $spacer = $end . PHP_EOL . " " . $start;
// determine length of encoded text within chunks
// and ensure length is even
@@ -1799,8 +1799,8 @@ function z_mail($params) {
$messageHeader =
$params['additionalMailHeader'] .
- "From: $fromName <{$params['fromEmail']}>\n" .
- "Reply-To: $fromName <{$params['replyTo']}>\n" .
+ "From: $fromName <{$params['fromEmail']}>" . PHP_EOL .
+ "Reply-To: $fromName <{$params['replyTo']}>" . PHP_EOL .
"Content-Type: text/plain; charset=UTF-8";
// send the message
diff --git a/util/service_class b/util/service_class
index 50f01afff..b8a1f2386 100755
--- a/util/service_class
+++ b/util/service_class
@@ -93,7 +93,12 @@ if($argc == 1) {
if(is_array(App::$config['service_class']) && App::$config['service_class']) {
foreach(App::$config['service_class'] as $class=>$props) {
echo "$class:\n";
- $d = unserialize($props);
+
+ $d = ((! is_array($props)) && (preg_match('|^a:[0-9]+:{.*}$|s', $props))
+ ? unserialize($props)
+ : $props
+ );
+
if(is_array($d) && $d) {
foreach($d as $k => $v) {
echo "\t$k = $v\n";
diff --git a/view/tpl/dreport.tpl b/view/tpl/dreport.tpl
index a6b05b326..89188891d 100644
--- a/view/tpl/dreport.tpl
+++ b/view/tpl/dreport.tpl
@@ -6,7 +6,7 @@
<i class="fa fa-cog"></i>
</button>
<div class="dropdown-menu">
- <a href="dreport/push/{{$mid}}" class="dropdown-item" >{{$push}}</a>
+ <a href="dreport/push/{{$safe_mid}}" class="dropdown-item">{{$push}}</a>
</div>
</div>
{{/if}}