aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/account.php2
-rw-r--r--include/bbcode.php30
-rw-r--r--include/conversation.php6
-rw-r--r--include/datetime.php2
-rw-r--r--include/event.php22
-rw-r--r--include/follow.php15
-rw-r--r--include/text.php6
-rw-r--r--include/zot.php10
8 files changed, 81 insertions, 12 deletions
diff --git a/include/account.php b/include/account.php
index 3ac485974..40cf281c3 100644
--- a/include/account.php
+++ b/include/account.php
@@ -530,7 +530,7 @@ function account_deny($hash) {
function account_approve($hash) {
- $ret = array('success' => false);
+ $ret = false;
// Note: when the password in the register table is 'verify', the uid actually contains the account_id
diff --git a/include/bbcode.php b/include/bbcode.php
index 03a46444b..b33766757 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -668,6 +668,31 @@ function bb_fixtable_lf($match) {
}
+function bbtopoll($s) {
+
+ $pl = [];
+
+ $match = '';
+ if(! preg_match("/\[poll=(.*?)\](.*?)\[\/poll\]/ism",$s,$match)) {
+ return null;
+ }
+ $pl['poll_id'] = $match[1];
+ $pl['poll_question'] = $match[2];
+
+ $match = '';
+ if(preg_match_all("/\[poll\-answer=(.*?)\](.*?)\[\/poll\-answer\]/is",$s,$match,PREG_SET_ORDER)) {
+ $pl['answer'] = [];
+ foreach($match as $m) {
+ $ans = [ 'answer_id' => $m[1], 'answer_text' => $m[2] ];
+ $pl['answer'][] = $ans;
+ }
+ }
+
+ return $pl;
+
+}
+
+
function parseIdentityAwareHTML($Text) {
// Hide all [noparse] contained bbtags by spacefying them
@@ -766,6 +791,11 @@ function bbcode($Text, $options = []) {
$ev = bbtoevent($Text);
+ // and the same with polls
+
+ $pl = bbtopoll($Text);
+
+
// 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
diff --git a/include/conversation.php b/include/conversation.php
index 0bb9c769a..6374267eb 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1005,7 +1005,7 @@ function thread_author_menu($item, $mode = '') {
$contact = App::$contacts[$item['author_xchan']];
else
if($local_channel && $item['author']['xchan_addr'])
- $follow_url = z_root() . '/follow/?f=&url=' . urlencode($item['author']['xchan_addr']);
+ $follow_url = z_root() . '/follow/?f=&url=' . urlencode($item['author']['xchan_addr']) . '&interactive=0';
if($item['uid'] > 0 && author_is_pmable($item['author'],$contact)) {
@@ -1051,8 +1051,8 @@ function thread_author_menu($item, $mode = '') {
'menu' => 'follow',
'title' => t('Connect'),
'icon' => 'fw',
- 'action' => '',
- 'href' => $follow_url
+ 'action' => 'doFollowAuthor(\'' . $follow_url . '\'); return false;',
+ 'href' => '#',
];
}
diff --git a/include/datetime.php b/include/datetime.php
index 1e9a1fa51..766c90d16 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -125,7 +125,7 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d
*/
function dob($dob) {
- if ($dob === '0000-00-00')
+ if ($dob === '0000-00-00' || $dob === '')
$value = '';
else
$value = (($year) ? datetime_convert('UTC','UTC',$dob,'Y-m-d') : datetime_convert('UTC','UTC',$dob,'m-d'));
diff --git a/include/event.php b/include/event.php
index 1077a3c64..84a16e8be 100644
--- a/include/event.php
+++ b/include/event.php
@@ -1322,3 +1322,25 @@ function translate_type($type) {
return [$type, t('Other') . ' (' . $type . ')'];
}
}
+
+
+function cal_store_lowlevel($arr) {
+
+ $store = [
+ 'cal_aid' => ((array_key_exists('cal_aid',$arr)) ? $arr['cal_aid'] : 0),
+ 'cal_uid' => ((array_key_exists('cal_uid',$arr)) ? $arr['cal_uid'] : 0),
+ 'cal_hash' => ((array_key_exists('cal_hash',$arr)) ? $arr['cal_hash'] : ''),
+ 'cal_name' => ((array_key_exists('cal_name',$arr)) ? $arr['cal_name'] : ''),
+ 'uri' => ((array_key_exists('uri',$arr)) ? $arr['uri'] : ''),
+ 'logname' => ((array_key_exists('logname',$arr)) ? $arr['logname'] : ''),
+ 'pass' => ((array_key_exists('pass',$arr)) ? $arr['pass'] : ''),
+ 'ctag' => ((array_key_exists('ctag',$arr)) ? $arr['ctag'] : ''),
+ 'synctoken' => ((array_key_exists('synctoken',$arr)) ? $arr['synctoken'] : ''),
+ 'cal_types' => ((array_key_exists('cal_types',$arr)) ? $arr['cal_types'] : ''),
+ ];
+
+ return create_table_from_array('cal', $store);
+
+}
+
+
diff --git a/include/follow.php b/include/follow.php
index 0843802c5..a63fe66ea 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -88,9 +88,18 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
// Premium channel, set confirm before callback to avoid recursion
- if(array_key_exists('connect_url',$j) && ($interactive) && (! $confirm))
- goaway(zid($j['connect_url']));
-
+ if(array_key_exists('connect_url',$j) && (! $confirm)) {
+ if($interactive) {
+ goaway(zid($j['connect_url']));
+ }
+ else {
+ $result['message'] = t('Premium channel - please visit:') . ' ' . zid($j['connect_url']);
+ logger('mod_follow: ' . $result['message']);
+ return $result;
+ }
+ }
+
+
// do we have an xchan and hubloc?
// If not, create them.
diff --git a/include/text.php b/include/text.php
index c82fad517..6675043e6 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3311,4 +3311,10 @@ function purify_filename($s) {
return $s;
}
+// callback for sorting the settings/featured entries.
+function featured_sort($a,$b) {
+ $s1 = substr($a,strpos($a,'id='),20);
+ $s2 = substr($b,strpos($b,'id='),20);
+ return(strcmp($s1,$s2));
+}
diff --git a/include/zot.php b/include/zot.php
index 0cfc370a2..25e30ccbc 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -171,6 +171,8 @@ function zot_build_packet($channel, $type = 'notify', $recipients = null, $remot
* packet type: one of 'ping', 'pickup', 'purge', 'refresh', 'keychange', 'force_refresh', 'notify', 'auth_check'
* @param array $recipients
* envelope information, array ( 'guid' => string, 'guid_sig' => string ); empty for public posts
+ * @param string msg
+ * optional message
* @param string $remote_key
* optional public site key of target hub used to encrypt entire packet
* NOTE: remote_key and encrypted packets are required for 'auth_check' packets, optional for all others
@@ -299,7 +301,7 @@ function zot_zot($url, $data, $channel = null,$crypto = null) {
if($channel) {
$headers['X-Zot-Token'] = random_string();
$hash = \Zotlabs\Web\HTTPSig::generate_digest($data,false);
- $headers['X-Zot-Digest'] = 'SHA-256=' . $hash;
+ $headers['X-Zot-Digest'] = 'SHA-256=' . $hash;
$h = \Zotlabs\Web\HTTPSig::create_sig('',$headers,$channel['channel_prvkey'],'acct:' . $channel['channel_address'] . '@' . \App::get_hostname(),false,false,'sha512',(($crypto) ? $crypto['hubloc_sitekey'] : ''), (($crypto) ? zot_best_algorithm($crypto['site_crypto']) : ''));
}
@@ -393,7 +395,7 @@ function zot_refresh($them, $channel = null, $force = false) {
if($s && intval($s[0]['site_dead']) && (! $force)) {
logger('zot_refresh: site ' . $url . ' is marked dead and force flag is not set. Cancelling operation.');
return false;
- }
+ }
$token = random_string();
@@ -1156,7 +1158,7 @@ function zot_process_response($hub, $arr, $outq) {
* and also that the signer and the sender match.
* If that happens, we do not need to fetch/pickup the message - we have it already and it is verified.
* Translate it into the form we need for zot_import() and import it.
- *
+ *
* Otherwise send back a pickup message, using our message tracking ID ($arr['secret']), which we will sign with our site
* private key.
* The entire pickup message is encrypted with the remote site's public key.
@@ -5090,7 +5092,7 @@ function zot_reply_refresh($sender, $recipients) {
function zot6_check_sig() {
$ret = [ 'success' => false ];
-
+
logger('server: ' . print_r($_SERVER,true), LOGGER_DATA);
if(array_key_exists('HTTP_SIGNATURE',$_SERVER)) {