diff --git a/addon/facebook/facebook.php b/addon/facebook/facebook.php index b1ba6342ad..dc1aa02dd9 100644 --- a/addon/facebook/facebook.php +++ b/addon/facebook/facebook.php @@ -725,8 +725,10 @@ function fb_consume_stream($uid,$j,$wall = false) { // don't store post if we don't have a contact - if(! x($datarray,'contact-id')) + if(! x($datarray,'contact-id')) { + logger('no contact: post ignored'); continue; + } $datarray['verb'] = ACTIVITY_POST; if($wall) { @@ -759,8 +761,10 @@ function fb_consume_stream($uid,$j,$wall = false) { intval($top_item), intval($uid) ); - if(count($r)) + if(count($r)) { $orig_post = $r[0]; + logger('fb: new top level item posted'); + } } if(isset($entry->likes) && isset($entry->likes->data)) diff --git a/boot.php b/boot.php index 0495c97d7c..a829daf9c1 100644 --- a/boot.php +++ b/boot.php @@ -4,7 +4,7 @@ set_time_limit(0); ini_set('pcre.backtrack_limit', 250000); -define ( 'FRIENDIKA_VERSION', '2.2.995' ); +define ( 'FRIENDIKA_VERSION', '2.2.996' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1059 ); diff --git a/include/group.php b/include/group.php index 8866104fca..d1b3369469 100644 --- a/include/group.php +++ b/include/group.php @@ -161,7 +161,7 @@ $o .= <<< EOT EOT; - $r = q("SELECT * FROM `group` WHERE `deleted` = 0 AND `uid` = %d", + $r = q("SELECT * FROM `group` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC", intval($_SESSION['uid']) ); if(count($r)) { diff --git a/include/items.php b/include/items.php index cbf5e4d24d..fbcac30cdf 100644 --- a/include/items.php +++ b/include/items.php @@ -742,6 +742,15 @@ function item_store($arr,$force_parent = false) { $arr['uri'], // already dbesc'd intval($arr['uid']) ); + if(! count($r)) { + // This is not good, but perhaps we encountered a rare race/cache condition, so back off and try again. + sleep(3); + $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", + $arr['uri'], // already dbesc'd + intval($arr['uid']) + ); + } + if(count($r)) { $current_post = $r[0]['id']; logger('item_store: created item ' . $current_post); diff --git a/mod/contacts.php b/mod/contacts.php index 2ed7f198e7..4baa2d2d7c 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -58,7 +58,7 @@ function contacts_post(&$a) { return; } } -logger('contact_edit ' . print_r($_POST,true)); + $priority = intval($_POST['poll']); if($priority == (-1)) @@ -269,7 +269,7 @@ function contacts_content(&$a) { '$lbl_rep2' => t('Occasionally your friends may wish to inquire about this person\'s online legitimacy.'), '$lbl_rep3' => t('You may help them choose whether or not to interact with this person by providing a reputation to guide them.'), '$lbl_rep4' => t('Please take a moment to elaborate on this selection if you feel it could be helpful to others.'), - '$visit' => t('Visit $name\'s profile'), + '$visit' => sprintf( t('Visit %s\'s profile [%s]'),$r[0]['name'],$r[0]['url']), '$blockunblock' => t('Block/Unblock contact'), '$ignorecont' => t('Ignore contact'), '$altcrepair' => t('Repair contact URL settings'), @@ -384,7 +384,7 @@ function contacts_content(&$a) { $o .= replace_macros($tpl, array( - '$img_hover' => t('Visit $username\'s profile'), + '$img_hover' => sprintf( t('Visit %s\'s profile [%s]'),$rr['name'],$rr['url']), '$edit_hover' => t('Edit contact'), '$id' => $rr['id'], '$alt_text' => $alt_text, diff --git a/mod/profile.php b/mod/profile.php index b80feab34a..52551c45f4 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -241,12 +241,13 @@ function profile_content(&$a, $update = 0) { `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`network`, `contact`.`rel`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` - FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` + FROM `item`, (SELECT `p`.`id`,`p`.`created` FROM `item` AS `p` WHERE `p`.`parent` = `p`.`id`) AS `parentitem`, `contact` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 + AND `contact`.`id` = `item`.`contact-id` AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - AND `item`.`parent` IN ( %s ) + AND `item`.`parent` = `parentitem`.`id` AND `item`.`parent` IN ( %s ) $sql_extra - ORDER BY `parent` DESC, `gravity` ASC, `item`.`id` ASC ", + ORDER BY `parentitem`.`created` DESC, `gravity` ASC, `item`.`created` ASC ", intval($a->profile['profile_uid']), dbesc($parents_str) ); diff --git a/mod/settings.php b/mod/settings.php index 0550429161..f898f171cc 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -111,6 +111,22 @@ function settings_post(&$a) { intval($mail_pubmail), intval(local_user()) ); + $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", + intval(local_user()) + ); + if(count($r)) { + $eacct = $r[0]; + require_once('include/email.php'); + $mb = construct_mailbox_name($eacct); + if(strlen($eacct['server'])) { + $dcrpass = ''; + openssl_private_decrypt(hex2bin($eacct['pass']),$dcrpass,$a->user['prvkey']); + $mbox = email_connect($mb,$mail_user,$dcrpass); + unset($dcrpass); + if(! $mbox) + notice( t('Failed to connect with email account using the settings provided.') . EOL); + } + } } $notify = 0; @@ -308,7 +324,7 @@ function settings_content(&$a) { $mail_user = ((count($r)) ? $r[0]['user'] : ''); $mail_replyto = ((count($r)) ? $r[0]['reply_to'] : ''); $mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0); - + $mail_chk = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00'); $pageset_tpl = get_markup_template('pagetypes.tpl'); $pagetype = replace_macros($pageset_tpl,array( @@ -484,6 +500,8 @@ function settings_content(&$a) { '$lbl_imap6' => t("Reply-to address \x28Optional\x29:"), '$imap_replyto' => $mail_replyto, '$lbl_imap7' => t('Send public posts to all email contacts:'), + '$lbl_imap8' => t('Last successful email check:'), + '$lbl_imap9' => (($mail_chk === '0000-00-00 00:00:00') ? t('never') : datetime_convert('UTC', date_default_timezone_get(), $mail_chk, t('g A l F d Y'))), '$pubmail_checked' => (($mail_pubmail) ? ' checked="checked" ' : ''), '$mail_disabled' => (($mail_disabled) ? '
' . t('Email access is disabled on this site.') . '
' : ''), '$imap_disabled' => $imap_disabled diff --git a/view/settings.tpl b/view/settings.tpl index 25f570be6e..077840ba43 100644 --- a/view/settings.tpl +++ b/view/settings.tpl @@ -169,6 +169,9 @@ $profile_in_net_dir $imap_desc $mail_disabled

+

+$lbl_imap8 $lbl_imap9 +