aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/attach.php7
-rw-r--r--include/cdav.php4
-rw-r--r--include/channel.php2
-rw-r--r--include/connections.php2
-rw-r--r--include/dir_fns.php24
-rw-r--r--include/help.php2
-rw-r--r--include/html2plain.php4
-rw-r--r--include/import.php4
-rwxr-xr-xinclude/items.php30
-rw-r--r--include/js_strings.php9
-rw-r--r--include/network.php12
-rw-r--r--include/text.php2
12 files changed, 58 insertions, 44 deletions
diff --git a/include/attach.php b/include/attach.php
index b4f697f81..f65f41477 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -2987,10 +2987,7 @@ function attach_folder_select_list($channel_id) {
if($r) {
foreach($r as $rv) {
- $x = attach_folder_rpaths($r,$rv);
- if($x) {
- $out[$x[0]] = $x[1];
- }
+ $out[$rv['hash']] = $rv['display_path'];
}
}
@@ -3020,7 +3017,7 @@ function attach_folder_rpaths($all_folders,$that_folder) {
if(! $found)
$error = true;
}
- while((! $found) && (! $error) && ($parent_hash != ''));
+ while((! $error) && ($parent_hash != ''));
}
return (($error) ? false : [ $current_hash , $path ]);
diff --git a/include/cdav.php b/include/cdav.php
index ef248a9fe..fcce0ec4a 100644
--- a/include/cdav.php
+++ b/include/cdav.php
@@ -111,7 +111,7 @@ function process_cdav_card($f, &$vcard, $edit = false) {
function import_cdav_card($id, $ext, $table, $column, $objects, $profile, $backend, &$ids, $notice = false) {
$i = 0;
- $newid = (count($ids) ? false : true);
+ $newid = (count($ids) ? false : true);
while ($object = $objects->getNext()) {
@@ -161,7 +161,7 @@ function import_cdav_card($id, $ext, $table, $column, $objects, $profile, $backe
);
}
- if($notice && $exp == 'vcf') {
+ if($notice && $ext == 'vcf') {
notice(
'<strong>' . t('INVALID CARD DISMISSED!') . '</strong>' . EOL .
'<strong>' . t('Name: ') . '</strong>' . (($object->FN) ? $object->FN : t('Unknown')) . EOL .
diff --git a/include/channel.php b/include/channel.php
index d610a0b9a..2d79cd074 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -651,7 +651,7 @@ function change_channel_keys($channel) {
foreach($h as $hv) {
$hv['hubloc_guid_sig'] = $sig;
$hv['hubloc_hash'] = $hash;
- $hv['hubloc_url_sig'] = base64url_encode(rsa_sign(z_root(),$modifed['channel_prvkey']));
+ $hv['hubloc_url_sig'] = base64url_encode(rsa_sign(z_root(),$modified['channel_prvkey']));
hubloc_store_lowlevel($hv);
}
}
diff --git a/include/connections.php b/include/connections.php
index bd41e112e..99a4cc71e 100644
--- a/include/connections.php
+++ b/include/connections.php
@@ -357,7 +357,7 @@ function contact_remove($channel_id, $abook_id) {
call_hooks('connection_remove',$x);
- $archive = get_pconfig($channel_id, 'system','archive_removed_contacts');
+ $archive = get_pconfig($channel_id, 'system', 'archive_removed_contacts');
if($archive) {
q("update abook set abook_archived = 1 where abook_id = %d and abook_channel = %d",
intval($abook_id),
diff --git a/include/dir_fns.php b/include/dir_fns.php
index f477b35dd..b0609ce8b 100644
--- a/include/dir_fns.php
+++ b/include/dir_fns.php
@@ -28,7 +28,7 @@ function find_upstream_directory($dirmode) {
);
if(($r) && ($r[0]['site_flags'] & DIRECTORY_MODE_STANDALONE)) {
$preferred = '';
- }
+ }
}
@@ -39,7 +39,7 @@ function find_upstream_directory($dirmode) {
* from our list of directory servers. However, if we're a directory
* server ourself, point at the local instance
* We will then set this value so this should only ever happen once.
- * Ideally there will be an admin setting to change to a different
+ * Ideally there will be an admin setting to change to a different
* directory server if you don't like our choice or if circumstances change.
*/
@@ -94,7 +94,7 @@ function get_directory_setting($observer, $setting) {
$ret = get_config('directory', $setting);
- // 'safemode' is the default if there is no observer or no established preference.
+ // 'safemode' is the default if there is no observer or no established preference.
if($setting == 'safemode' && $ret === false)
$ret = 1;
@@ -152,8 +152,8 @@ function dir_sort_links() {
*
* Checks the directory mode of this hub to see if it is some form of directory server. If it is,
* get the directory realm of this hub. Fetch a list of all other directory servers in this realm and request
- * a directory sync packet. This will contain both directory updates and new ratings. Store these all in the DB.
- * In the case of updates, we will query each of them asynchronously from a poller task. Ratings are stored
+ * a directory sync packet. This will contain both directory updates and new ratings. Store these all in the DB.
+ * In the case of updates, we will query each of them asynchronously from a poller task. Ratings are stored
* directly if the rater's signature matches.
*
* @param int $dirmode;
@@ -189,7 +189,7 @@ function sync_directories($dirmode) {
[
'site_url' => DIRECTORY_FALLBACK_MASTER,
'site_flags' => DIRECTORY_MODE_PRIMARY,
- 'site_update' => NULL_DATE,
+ 'site_update' => NULL_DATE,
'site_directory' => DIRECTORY_FALLBACK_MASTER . '/dirsearch',
'site_realm' => DIRECTORY_REALM,
'site_valid' => 1,
@@ -335,11 +335,11 @@ function update_directory_entry($ud) {
// modify the directory search to only return zot6 entries, and also modify this function
// to *only* fetch the zot6 entries.
// Otherwise we'll be showing duplicates or have a mostly empty directory for a good chunk of
- // the transition period. Directory server load will likely increase "moderately" during this transition.
- // The one month counter begins when the primary directory has upgraded to a release which uses this code.
+ // the transition period. Directory server load will likely increase "moderately" during this transition.
+ // The one month counter begins when the primary directory has upgraded to a release which uses this code.
// Hubzilla channels running traditional zot which have not upgraded can or will be dropped from the directory or
// "not found" at the end of the transition period as the directory will only serve zot6 entries at that time.
-
+
$uri = Webfinger::zot_url($ud['ud_addr']);
if($uri) {
$record = Zotfinger::exec($uri);
@@ -347,8 +347,8 @@ function update_directory_entry($ud) {
// Check the HTTP signature
$hsig = $record['signature'];
- if($hsig && $hsig['signer'] === $url && $hsig['header_valid'] === true && $hsig['content_valid'] === true) {
- $x = \Zotlabs\Lib\Libzot::import_xchan($record['data'], 0, $ud);
+ if($hsig && $hsig['signer'] === $uri && $hsig['header_valid'] === true && $hsig['content_valid'] === true) {
+ $x = Libzot::import_xchan($record['data'], 0, $ud);
if($x['success']) {
$success = true;
}
@@ -394,7 +394,7 @@ function local_dir_update($uid, $force) {
$profile['description'] = $p[0]['pdesc'];
$profile['birthday'] = $p[0]['dob'];
- if ($age = age($p[0]['dob'],$p[0]['channel_timezone'],''))
+ if ($age = age($p[0]['dob'],$p[0]['channel_timezone'],''))
$profile['age'] = $age;
$profile['gender'] = $p[0]['gender'];
diff --git a/include/help.php b/include/help.php
index affe64495..ebf1ccc08 100644
--- a/include/help.php
+++ b/include/help.php
@@ -299,7 +299,7 @@ function load_context_help() {
break;
array_pop($args);
- $path = implode($args,'/');
+ $path = implode('/', $args);
}
return $context_help;
diff --git a/include/html2plain.php b/include/html2plain.php
index 979354079..fde70bd01 100644
--- a/include/html2plain.php
+++ b/include/html2plain.php
@@ -40,7 +40,7 @@ function breaklines($line, $level, $wraplength = 75)
$newlines[] = $line;
- return(implode($newlines, "\n"));
+ return(implode("\n", $newlines));
}
function quotelevel($message, $wraplength = 75)
@@ -73,7 +73,7 @@ function quotelevel($message, $wraplength = 75)
if (!$startquote or ($line != ''))
$newlines[] = breaklines($line, $currlevel, $wraplength);
}
- return(implode($newlines, "\n"));
+ return(implode("\n", $newlines));
}
function collecturls($message) {
diff --git a/include/import.php b/include/import.php
index d02cc1e1f..82d6cfe07 100644
--- a/include/import.php
+++ b/include/import.php
@@ -1358,7 +1358,7 @@ function sync_files($channel, $files) {
$headers = [];
$headers['Accept'] = 'application/x-zot+json' ;
$headers['Sigtoken'] = random_string();
- $headers = HTTPSig::create_sig($headers,$channel['channel_prvkey'], 'acct:' . channel_reddress($channel),true,'sha512');
+ $headers = HTTPSig::create_sig($headers, $channel['channel_prvkey'], channel_reddress($channel), true, 'sha512');
$x = z_post_url($fetch_url,$parr,$redirects,[ 'filep' => $fp, 'headers' => $headers]);
fclose($fp);
@@ -1463,7 +1463,7 @@ function sync_files($channel, $files) {
$headers = [];
$headers['Accept'] = 'application/x-zot+json' ;
$headers['Sigtoken'] = random_string();
- $headers = HTTPSig::create_sig($headers,$channel['channel_prvkey'],'acct:' . channel_reddress($channel),true,'sha512');
+ $headers = HTTPSig::create_sig($headers, $channel['channel_prvkey'], channel_url($channel), true, 'sha512');
$x = z_post_url($fetch_url,$parr,$redirects,[ 'filep' => $fp, 'headers' => $headers]);
fclose($fp);
diff --git a/include/items.php b/include/items.php
index 2426c189f..85465192d 100755
--- a/include/items.php
+++ b/include/items.php
@@ -2206,6 +2206,7 @@ function item_store_update($arr, $allow_exec = false, $deliver = true) {
return $ret;
}
+
// override the unseen flag with the original
$arr['item_unseen'] = $orig[0]['item_unseen'];
@@ -2682,6 +2683,12 @@ function tag_deliver($uid, $item_id) {
if ($is_group && intval($item['item_thread_top']) && intval($item['item_wall']) && $item['author_xchan'] !== $item['owner_xchan']) {
+
+ if($item['resource_type'] === 'group_item') {
+ logger('resource_type group_item: already shared');
+ return;
+ }
+
if (strpos($item['body'],'[/share]')) {
logger('W2W post already shared');
return;
@@ -3113,11 +3120,12 @@ function tgroup_check($uid, $item) {
}
}
}
-*/
+
if(! $found) {
logger('tgroup_check: mention was in a reshare or exceeded max_tagged_forums - ignoring');
continue;
}
+*/
return true;
}
@@ -3203,16 +3211,18 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false
$arr = [];
if ($edit) {
+
// process edit or delete action
- $r = q("select * from item where source_xchan = '%s' and body like '%s' and uid = %d limit 1",
- dbesc($item['owner_xchan']),
- dbesc("%message_id='" . $item['mid'] . "'%"),
- intval($channel['channel_id'])
+ $r = q("select * from item where uid = %d and resource_id = '%s' and source_xchan = '%s' and resource_type = 'group_item' limit 1",
+ intval($channel['channel_id']),
+ dbesc($item['mid']),
+ dbesc($item['author_xchan'])
);
+
if ($r) {
if (intval($item['item_deleted'])) {
- drop_item($r[0]['id'],false,DROPITEM_PHASE1);
- Master::Summon([ 'Notifier','drop',$r[0]['id'] ]);
+ drop_item($r[0]['id'], false, DROPITEM_PHASE1);
+ Master::Summon([ 'Notifier', 'drop', $r[0]['id'] ]);
return;
}
$arr['id'] = intval($r[0]['id']);
@@ -3242,6 +3252,9 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false
$arr['item_uplink'] = 0;
$arr['source_xchan'] = $item['owner_xchan'];
+ $arr['resource_id'] = $item['mid'];
+ $arr['resource_type'] = 'group_item';
+
$arr['item_private'] = (($channel['channel_allow_cid'] || $channel['channel_allow_gid']
|| $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 1 : 0);
@@ -3263,12 +3276,13 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false
"' message_id='" . $item['mid'] .
"']";
if($item['title'])
- $bb .= '[b]'.$item['title'].'[/b]'."\r\n";
+ $bb .= '[h3][b]'.$item['title'].'[/b][/h3]'."\r\n";
$bb .= $item['body'];
$bb .= "[/share]";
}
$arr['body'] = $bb;
+ $arr['term'] = $item['term'];
$arr['author_xchan'] = $channel['channel_hash'];
$arr['owner_xchan'] = $channel['channel_hash'];
diff --git a/include/js_strings.php b/include/js_strings.php
index 6f559f4c4..e06e105fd 100644
--- a/include/js_strings.php
+++ b/include/js_strings.php
@@ -47,10 +47,10 @@ function js_strings() {
'days' => tt('%d days', '%d days', '%d'),
'months' => tt('%d months', '%d months', '%d'),
'years' => tt('%d years', '%d years', '%d'),
-
+
// get plural function code
'plural_func' => tf(),
-
+
'$t01' => ((t('timeago.prefixAgo') == 'timeago.prefixAgo') ? '' : ((t('timeago.prefixAgo') == 'NONE') ? '' : t('timeago.prefixAgo'))),
'$t02' => ((t('timeago.prefixFromNow') == 'timeago.prefixFromNow') ? '' : ((t('timeago.prefixFromNow') == 'NONE') ? '' : t('timeago.prefixFromNow'))),
'$t03' => ((t('timeago.suffixAgo') == 'timeago.suffixAgo') ? 'ago' : ((t('timeago.suffixAgo') == 'NONE') ? '' : t('timeago.suffixAgo'))),
@@ -113,6 +113,9 @@ function js_strings() {
'$month' => t('month','calendar'),
'$week' => t('week','calendar'),
'$day' => t('day','calendar'),
- '$allday' => t('All day','calendar')
+ '$allday' => t('All day','calendar'),
+
+ // mod cloud
+ '$download_info' => t('Please stand by while your download is being prepared.')
));
}
diff --git a/include/network.php b/include/network.php
index bcd66cf85..324a99eba 100644
--- a/include/network.php
+++ b/include/network.php
@@ -714,7 +714,7 @@ function sxml2array ( $xmlObject, $out = array () )
* @brief xml2array() will convert the given XML text to an array in the XML structure.
*
* Link: http://www.bin-co.com/php/scripts/xml2array/
- * Portions significantly re-written by mike@macgirvin.com
+ * Portions significantly re-written by mike@macgirvin.com
* (namespaces, lowercase tags, get_attribute default changed, more...)
*
* Examples: $array = xml2array(file_get_contents('feed.xml'));
@@ -1113,8 +1113,8 @@ function discover_by_webbie($webbie, $protocol = '') {
// Check the HTTP signature
$hsig = $record['signature'];
- if($hsig && ($hsig['signer'] === $url || $hsig['signer'] === $link['href']) && $hsig['header_valid'] === true && $hsig['content_valid'] === true)
- $hsig_valid = true;
+ if($hsig && $hsig['signer'] === $link['href'] && $hsig['header_valid'] === true && $hsig['content_valid'] === true)
+ $hsig_valid = true;
if(! $hsig_valid) {
logger('http signature not valid: ' . print_r($hsig,true));
@@ -1431,7 +1431,7 @@ function scrape_feed($url) {
function do_delivery($deliveries, $force = false) {
// $force is set if a site that wasn't responding suddenly returns to life.
- // Try and shove through everything going to that site while it's responding.
+ // Try and shove through everything going to that site while it's responding.
if(! (is_array($deliveries) && count($deliveries)))
return;
@@ -2069,7 +2069,7 @@ function get_request_string($url) {
* Takes the output of parse_url and builds a URL from it
*
*/
-
+
function unparse_url($parsed_url) {
$scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
$host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
@@ -2081,4 +2081,4 @@ function unparse_url($parsed_url) {
$query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : '';
$fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
return "$scheme$user$pass$host$port$path$query$fragment";
-}
+}
diff --git a/include/text.php b/include/text.php
index 76df9e17b..d6b196f1e 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1801,7 +1801,7 @@ function prepare_body(&$item,$attach = false,$opts = false) {
$tags = format_hashtags($item);
- if($item['resource_type'])
+ if($item['resource_type'] == 'photo')
$mentions = format_mentions($item);
$categories = format_categories($item,$writeable);