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;
}
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')) {
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;
}
}
}
- 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();
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) {