if(x($_GET,'last_update'))
$last_update = $a->config['dfrn_poll_last_update'] = $_GET['last_update'];
- if(($dfrn_id == '') && ($a->argc > 1)) {
+ if(($dfrn_id == '') && (! x($_POST,'dfrn_id')) && ($a->argc > 1)) {
$o = get_feed_for($a,'*', $a->argv[1],$last_update);
echo $o;
killme();
$r = q("SELECT `contact`.*, `user`.`nickname`
FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
- WHERE `issued-id` = '%s' LIMIT 1",
+ WHERE `dfrn-id` = '%s' LIMIT 1",
dbesc($dfrn_id));
if(count($r)) {
$s = fetch_url($r[0]['poll'] . '?dfrn_id=' . $dfrn_id . '&type=profile-check');
if((int) $xml->status == 1) {
$_SESSION['authenticated'] = 1;
$_SESSION['visitor_id'] = $r[0]['id'];
- $_SESSION['sysmsg'] .= "Hi {$r[0]['name']}" . EOL;
+ notice( t('Hi ') . $r[0]['name'] . EOL);
// Visitors get 1 day session.
$session_id = session_id();
$expire = time() + 86400;
$r = q("SELECT * FROM `contact` WHERE `issued-id` = '%s' AND `blocked` = 0 AND `pending` = 0 LIMIT 1",
dbesc($_GET['dfrn_id']));
- if((! count($r)) || (! strlen($r[0]['prvkey'])))
- $status = 1;
+ if((count($r)) && (strlen($r[0]['prvkey']))) {
- $challenge = '';
+ $challenge = '';
- openssl_private_encrypt($hash,$challenge,$r[0]['prvkey']);
- $challenge = bin2hex($challenge);
+ openssl_private_encrypt($hash,$challenge,$r[0]['prvkey']);
+ $challenge = bin2hex($challenge);
- $encrypted_id = '';
- $id_str = $_GET['dfrn_id'] . '.' . mt_rand(1000,9999);
-
- openssl_private_encrypt($id_str,$encrypted_id,$r[0]['prvkey']);
- $encrypted_id = bin2hex($encrypted_id);
+ $encrypted_id = '';
+ $id_str = $_GET['dfrn_id'] . '.' . mt_rand(1000,9999);
+ openssl_private_encrypt($id_str,$encrypted_id,$r[0]['prvkey']);
+ $encrypted_id = bin2hex($encrypted_id);
+ }
+ else {
+ $status = 1; // key not found
+ }
echo '<?xml version="1.0" encoding="UTF-8"?><dfrn_poll><status>' .$status . '</status><dfrn_id>' . $encrypted_id . '</dfrn_id>'
. '<challenge>' . $challenge . '</challenge></dfrn_poll>' . "\r\n" ;