From: Hypolite Petovan Date: Wed, 3 Jan 2018 00:30:41 +0000 (-0500) Subject: Merge branch 'develop' into task/3954-move-auth-to-src X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9a3e773a9a0464a309e4891f40c1105c8e2fed33;p=friendica.git Merge branch 'develop' into task/3954-move-auth-to-src --- 9a3e773a9a0464a309e4891f40c1105c8e2fed33 diff --cc include/identity.php index 9c315efbde,0ad0e646dc..d78935778a --- a/include/identity.php +++ b/include/identity.php @@@ -932,16 -920,15 +920,16 @@@ function get_my_url( function zrl_init(App $a) { - $tmp_str = get_my_url(); - if (validate_url($tmp_str)) { + $my_url = get_my_url(); + $my_url = validate_url($my_url); + if ($my_url) { // Is it a DDoS attempt? // The check fetches the cached value from gprobe to reduce the load for this system - $urlparts = parse_url($tmp_str); + $urlparts = parse_url($my_url); - $result = Cache::get("gprobe:" . $urlparts["host"]); - if ((!is_null($result)) && (in_array($result["network"], array(NETWORK_FEED, NETWORK_PHANTOM)))) { - logger("DDoS attempt detected for " . $urlparts["host"] . " by " . $_SERVER["REMOTE_ADDR"] . ". server data: " . print_r($_SERVER, true), LOGGER_DEBUG); + $result = Cache::get('gprobe:' . $urlparts['host']); + if ((!is_null($result)) && (in_array($result['network'], array(NETWORK_FEED, NETWORK_PHANTOM)))) { + logger('DDoS attempt detected for ' . $urlparts['host'] . ' by ' . $_SERVER['REMOTE_ADDR'] . '. server data: ' . print_r($_SERVER, true), LOGGER_DEBUG); return; } diff --cc mod/dfrn_poll.php index d27c7d6214,ff6c31b627..69e86f1bc2 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@@ -11,19 -11,19 +12,20 @@@ use Friendica\Protocol\DFRN use Friendica\Protocol\OStatus; require_once 'include/items.php'; -require_once 'include/auth.php'; - function dfrn_poll_init(App $a) { + function dfrn_poll_init(App $a) + { - $dfrn_id = x($_GET,'dfrn_id') ? $_GET['dfrn_id'] : ''; - $type = x($_GET,'type') ? $_GET['type'] : 'data'; - $last_update = x($_GET,'last_update') ? $_GET['last_update'] : ''; - $destination_url = x($_GET,'destination_url') ? $_GET['destination_url'] : ''; - $challenge = x($_GET,'challenge') ? $_GET['challenge'] : ''; - $sec = x($_GET,'sec') ? $_GET['sec'] : ''; - $dfrn_version = x($_GET,'dfrn_version') ? (float) $_GET['dfrn_version'] : 2.0; - $perm = x($_GET,'perm') ? $_GET['perm'] : 'r'; - $quiet = x($_GET,'quiet') ? true : false; + Login::sessionAuth(); + - $dfrn_id = ((x($_GET,'dfrn_id')) ? $_GET['dfrn_id'] : ''); - $type = ((x($_GET,'type')) ? $_GET['type'] : 'data'); - $last_update = ((x($_GET,'last_update')) ? $_GET['last_update'] : ''); - $destination_url = ((x($_GET,'destination_url')) ? $_GET['destination_url'] : ''); - $challenge = ((x($_GET,'challenge')) ? $_GET['challenge'] : ''); - $sec = ((x($_GET,'sec')) ? $_GET['sec'] : ''); - $dfrn_version = ((x($_GET,'dfrn_version')) ? (float) $_GET['dfrn_version'] : 2.0); - $perm = ((x($_GET,'perm')) ? $_GET['perm'] : 'r'); - $quiet = ((x($_GET,'quiet')) ? true : false); ++ $dfrn_id = defaults($_GET, 'dfrn_id' , ''); ++ $type = defaults($_GET, 'type' , 'data'); ++ $last_update = defaults($_GET, 'last_update' , ''); ++ $destination_url = defaults($_GET, 'destination_url', ''); ++ $challenge = defaults($_GET, 'challenge' , ''); ++ $sec = defaults($_GET, 'sec' , ''); ++ $dfrn_version = defaults($_GET, 'dfrn_version' , 2.0); ++ $perm = defaults($_GET, 'perm' , 'r'); ++ $quiet = x($_GET, 'quiet'); // Possibly it is an OStatus compatible server that requests a user feed if (($a->argc > 1) && ($dfrn_id == '') && !strstr($_SERVER["HTTP_USER_AGENT"], 'Friendica')) { diff --cc mod/profile.php index 9d4bd57c89,de0e345573..f439f754c0 --- a/mod/profile.php +++ b/mod/profile.php @@@ -5,27 -5,25 +5,27 @@@ use Friendica\Core\Config use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Database\DBM; +use Friendica\Model\Group; +use Friendica\Module\Login; - require_once('include/contact_widgets.php'); - require_once('include/redir.php'); + require_once 'include/contact_widgets.php'; + require_once 'include/redir.php'; - function profile_init(App $a) { - - if(! x($a->page,'aside')) + function profile_init(App $a) + { + if (!x($a->page, 'aside')) { $a->page['aside'] = ''; + } - if($a->argc > 1) + if ($a->argc > 1) { $which = htmlspecialchars($a->argv[1]); - else { - $r = q("select nickname from user where blocked = 0 and account_expired = 0 and account_removed = 0 and verified = 1 order by rand() limit 1"); + } else { + $r = q("SELECT `nickname` FROM `user` WHERE `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 ORDER BY RAND() LIMIT 1"); if (DBM::is_result($r)) { goaway(System::baseUrl() . '/profile/' . $r[0]['nickname']); - } - else { + } else { logger('profile error: mod_profile ' . $a->query_string, LOGGER_DEBUG); - notice( t('Requested profile is not available.') . EOL ); + notice(t('Requested profile is not available.') . EOL); $a->error = 404; return; } @@@ -96,21 -96,21 +98,21 @@@ function profile_content(App $a, $updat } } - if (! x($category)) { - $category = ((x($_GET,'category')) ? $_GET['category'] : ''); + if (!x($category)) { + $category = defaults($_GET, 'category', ''); } - $hashtags = (x($_GET, 'tag') ? $_GET['tag'] : ''); + $hashtags = defaults($_GET, 'tag', ''); - if (Config::get('system','block_public') && (! local_user()) && (! remote_user())) { + if (Config::get('system', 'block_public') && !local_user() && !remote_user()) { - return login(); + return Login::form(); } - require_once("include/bbcode.php"); - require_once('include/security.php'); - require_once('include/conversation.php'); - require_once('include/acl_selectors.php'); - require_once('include/items.php'); + require_once 'include/bbcode.php'; + require_once 'include/security.php'; + require_once 'include/conversation.php'; + require_once 'include/acl_selectors.php'; + require_once 'include/items.php'; $groups = array(); diff --cc mod/videos.php index 11b7e21be7,c4e5d0aaa4..a7759f7419 --- a/mod/videos.php +++ b/mod/videos.php @@@ -6,13 -6,12 +6,13 @@@ use Friendica\Core\System use Friendica\Core\Worker; use Friendica\Database\DBM; use Friendica\Model\Contact; +use Friendica\Model\Group; - require_once('include/items.php'); - require_once('include/acl_selectors.php'); - require_once('include/bbcode.php'); - require_once('include/security.php'); - require_once('include/redir.php'); + require_once 'include/items.php'; + require_once 'include/acl_selectors.php'; + require_once 'include/bbcode.php'; + require_once 'include/security.php'; + require_once 'include/redir.php'; function videos_init(App $a) {