X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fdfrn_poll.php;h=1e07242875086506355f90822dd338d5122f4fd1;hb=a5e91175243a41c77a56e73efc3672f20a7e6d23;hp=f74429e5803b43a660c51edd579840ccc21f3b5a;hpb=4dce3d822470537e40a0f77330d62ac05bf73806;p=friendica.git diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index f74429e580..1e07242875 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -1,12 +1,18 @@ argc > 1) && ($dfrn_id == '') && !strstr($_SERVER["HTTP_USER_AGENT"], 'Friendica')) { + $nickname = $a->argv[1]; + header("Content-type: application/atom+xml"); + echo OStatus::feed($a, $nickname, $last_update, 10); + killme(); + } + $direction = (-1); @@ -28,7 +42,7 @@ function dfrn_poll_init(App &$a) { $hidewall = false; if(($dfrn_id === '') && (! x($_POST,'dfrn_id'))) { - if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { + if((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) { http_status_exit(403); } @@ -47,7 +61,7 @@ function dfrn_poll_init(App &$a) { logger('dfrn_poll: public feed request from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $user); header("Content-type: application/atom+xml"); - echo dfrn::feed('', $user,$last_update, 0, $hidewall); + echo DFRN::feed('', $user,$last_update, 0, $hidewall); killme(); } @@ -68,7 +82,7 @@ function dfrn_poll_init(App &$a) { $my_id = '0:' . $dfrn_id; break; default: - goaway(z_root()); + goaway(System::baseUrl()); break; // NOTREACHED } @@ -79,7 +93,7 @@ function dfrn_poll_init(App &$a) { dbesc($a->argv[1]) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $s = fetch_url($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check'); @@ -112,9 +126,9 @@ function dfrn_poll_init(App &$a) { } } $profile = $r[0]['nickname']; - goaway((strlen($destination_url)) ? $destination_url : App::get_baseurl() . '/profile/' . $profile); + goaway((strlen($destination_url)) ? $destination_url : System::baseUrl() . '/profile/' . $profile); } - goaway(z_root()); + goaway(System::baseUrl()); } @@ -126,7 +140,7 @@ function dfrn_poll_init(App &$a) { $r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1", dbesc($sec) ); - if (! dbm::is_result($r)) { + if (! DBM::is_result($r)) { xml_status(3, 'No ticket'); // NOTREACHED } @@ -137,7 +151,7 @@ function dfrn_poll_init(App &$a) { $c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", intval($r[0]['cid']) ); - if(! count($c)) { + if (! DBM::is_result($c)) { xml_status(3, 'No profile'); } $contact = $c[0]; @@ -163,7 +177,7 @@ function dfrn_poll_init(App &$a) { if($final_dfrn_id != $orig_id) { logger('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG); - // did not decode properly - cannot trust this site + // did not decode properly - cannot trust this site xml_status(3, 'Bad decryption'); } @@ -190,7 +204,7 @@ function dfrn_poll_init(App &$a) { q("DELETE FROM `profile_check` WHERE `expire` < " . intval(time())); $r = q("SELECT * FROM `profile_check` WHERE `dfrn_id` = '%s' ORDER BY `expire` DESC", dbesc($dfrn_id)); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { xml_status(1); return; // NOTREACHED } @@ -203,7 +217,7 @@ function dfrn_poll_init(App &$a) { -function dfrn_poll_post(App &$a) { +function dfrn_poll_post(App $a) { $dfrn_id = ((x($_POST,'dfrn_id')) ? $_POST['dfrn_id'] : ''); $challenge = ((x($_POST,'challenge')) ? $_POST['challenge'] : ''); @@ -223,7 +237,7 @@ function dfrn_poll_post(App &$a) { $r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1", dbesc($sec) ); - if (! dbm::is_result($r)) { + if (! DBM::is_result($r)) { xml_status(3, 'No ticket'); // NOTREACHED } @@ -234,7 +248,7 @@ function dfrn_poll_post(App &$a) { $c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", intval($r[0]['cid']) ); - if(! count($c)) { + if (! DBM::is_result($c)) { xml_status(3, 'No profile'); } $contact = $c[0]; @@ -260,7 +274,7 @@ function dfrn_poll_post(App &$a) { if($final_dfrn_id != $orig_id) { logger('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG); - // did not decode properly - cannot trust this site + // did not decode properly - cannot trust this site xml_status(3, 'Bad decryption'); } @@ -284,7 +298,7 @@ function dfrn_poll_post(App &$a) { dbesc($challenge) ); - if (! dbm::is_result($r)) { + if (! DBM::is_result($r)) { killme(); } @@ -312,7 +326,7 @@ function dfrn_poll_post(App &$a) { $my_id = '0:' . $dfrn_id; break; default: - goaway(z_root()); + goaway(System::baseUrl()); break; // NOTREACHED } @@ -320,7 +334,7 @@ function dfrn_poll_post(App &$a) { $r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 $sql_extra LIMIT 1"); - if (! dbm::is_result($r)) { + if (! DBM::is_result($r)) { killme(); } @@ -337,7 +351,7 @@ function dfrn_poll_post(App &$a) { $reputation = 0; $text = ''; - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $reputation = $r[0]['rating']; $text = $r[0]['reason']; @@ -376,14 +390,14 @@ function dfrn_poll_post(App &$a) { } header("Content-type: application/atom+xml"); - $o = dfrn::feed($dfrn_id, $a->argv[1], $last_update, $direction); + $o = DFRN::feed($dfrn_id, $a->argv[1], $last_update, $direction); echo $o; killme(); } } -function dfrn_poll_content(App &$a) { +function dfrn_poll_content(App $a) { $dfrn_id = ((x($_GET,'dfrn_id')) ? $_GET['dfrn_id'] : ''); $type = ((x($_GET,'type')) ? $_GET['type'] : 'data'); @@ -437,7 +451,7 @@ function dfrn_poll_content(App &$a) { $my_id = '0:' . $dfrn_id; break; default: - goaway(z_root()); + goaway(System::baseUrl()); break; // NOTREACHED } @@ -450,7 +464,7 @@ function dfrn_poll_content(App &$a) { dbesc($nickname) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $challenge = ''; $encrypted_id = ''; @@ -497,21 +511,22 @@ function dfrn_poll_content(App &$a) { )); } - $profile = ((dbm::is_result($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname); + $profile = ((DBM::is_result($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname); switch($destination_url) { case 'profile': - $dest = App::get_baseurl() . '/profile/' . $profile . '?f=&tab=profile'; + $dest = System::baseUrl() . '/profile/' . $profile . '?f=&tab=profile'; break; case 'photos': - $dest = App::get_baseurl() . '/photos/' . $profile; + $dest = System::baseUrl() . '/photos/' . $profile; break; case 'status': case '': - $dest = App::get_baseurl() . '/profile/' . $profile; + $dest = System::baseUrl() . '/profile/' . $profile; break; default: - $dest = $destination_url . '?f=&redir=1'; + $appendix = (strstr($destination_url, '?') ? '&f=&redir=1' : '?f=&redir=1'); + $dest = $destination_url . $appendix; break; }