Rename App Methods

- renamed a lot of App methods to CamelCase
- replaced direct public variables with get-/set-Methods
This commit is contained in:
Philipp Holzer 2018-10-09 19:58:58 +02:00
parent 5f9dd11cfb
commit 5a02e39a65
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
94 changed files with 481 additions and 338 deletions

View file

@ -39,7 +39,7 @@ class Login extends BaseModule
}
if (local_user()) {
goaway(self::getApp()->get_baseurl());
goaway(self::getApp()->getBaseURL());
}
return self::form($_SESSION['return_url'], intval(Config::get('config', 'register_policy')) !== REGISTER_CLOSED);
@ -86,18 +86,18 @@ class Login extends BaseModule
// if it's an email address or doesn't resolve to a URL, fail.
if ($noid || strpos($openid_url, '@') || !Network::isUrlValid($openid_url)) {
notice(L10n::t('Login failed.') . EOL);
goaway(self::getApp()->get_baseurl());
goaway(self::getApp()->getBaseURL());
// NOTREACHED
}
// Otherwise it's probably an openid.
try {
$a = get_app();
$openid = new LightOpenID($a->get_hostname());
$openid = new LightOpenID($a->getHostName());
$openid->identity = $openid_url;
$_SESSION['openid'] = $openid_url;
$_SESSION['remember'] = $remember;
$openid->returnUrl = self::getApp()->get_baseurl(true) . '/openid';
$openid->returnUrl = self::getApp()->getBaseURL(true) . '/openid';
goaway($openid->authUrl());
} catch (Exception $e) {
notice(L10n::t('We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID.') . '<br /><br >' . L10n::t('The error message was:') . ' ' . $e->getMessage());
@ -191,7 +191,7 @@ class Login extends BaseModule
if ($data->hash != cookie_hash($user)) {
logger("Hash for user " . $data->uid . " doesn't fit.");
nuke_session();
goaway(self::getApp()->get_baseurl());
goaway(self::getApp()->getBaseURL());
}
// Renew the cookie
@ -228,7 +228,7 @@ class Login extends BaseModule
logger('Session address changed. Paranoid setting in effect, blocking session. ' .
$_SESSION['addr'] . ' != ' . $_SERVER['REMOTE_ADDR']);
nuke_session();
goaway(self::getApp()->get_baseurl());
goaway(self::getApp()->getBaseURL());
}
$user = DBA::selectFirst('user', [],
@ -242,7 +242,7 @@ class Login extends BaseModule
);
if (!DBA::isResult($user)) {
nuke_session();
goaway(self::getApp()->get_baseurl());
goaway(self::getApp()->getBaseURL());
}
// Make sure to refresh the last login time for the user if the user
@ -297,7 +297,7 @@ class Login extends BaseModule
$a->page['htmlhead'] .= replace_macros(
get_markup_template('login_head.tpl'),
[
'$baseurl' => $a->get_baseurl(true)
'$baseurl' => $a->getBaseURL(true)
]
);
@ -308,7 +308,7 @@ class Login extends BaseModule
$o .= replace_macros(
$tpl,
[
'$dest_url' => self::getApp()->get_baseurl(true) . '/login',
'$dest_url' => self::getApp()->getBaseURL(true) . '/login',
'$logout' => L10n::t('Logout'),
'$login' => L10n::t('Login'),

View file

@ -26,6 +26,6 @@ class Logout extends BaseModule
Addon::callHooks("logging_out");
nuke_session();
info(L10n::t('Logged out.') . EOL);
goaway(self::getApp()->get_baseurl());
goaway(self::getApp()->getBaseURL());
}
}

View file

@ -47,7 +47,7 @@ class Magic extends BaseModule
$contact = DBA::selectFirst('contact', ['id', 'nurl', 'url'], ['id' => $cid]);
// Redirect if the contact is already authenticated on this site.
if (!empty($a->contact) && array_key_exists('id', $a->contact) && strpos($contact['nurl'], normalise_link(self::getApp()->get_baseurl())) !== false) {
if (!empty($a->contact) && array_key_exists('id', $a->contact) && strpos($contact['nurl'], normalise_link(self::getApp()->getBaseURL())) !== false) {
if ($test) {
$ret['success'] = true;
$ret['message'] .= 'Local site - you are already authenticated.' . EOL;
@ -78,7 +78,7 @@ class Magic extends BaseModule
$headers = HTTPSignature::createSig(
$headers,
$user['prvkey'],
'acct:' . $user['nickname'] . '@' . $a->get_hostname() . ($a->urlpath ? '/' . $a->urlpath : '')
'acct:' . $user['nickname'] . '@' . $a->getHostName() . ($a->getURLpath() ? '/' . $a->getURLpath() : '')
);
// Try to get an authentication token from the other instance.

View file

@ -71,7 +71,7 @@ class Proxy extends BaseModule
$thumb = false;
$size = 1024;
$sizetype = '';
$basepath = $a->get_basepath();
$basepath = $a->getBasePath();
// If the cache path isn't there, try to create it
if (!is_dir($basepath . '/proxy') && is_writable($basepath)) {
@ -196,7 +196,7 @@ class Proxy extends BaseModule
unlink($tempfile);
// If there is an error then return a blank image
if ((substr($a->get_curl_code(), 0, 1) == '4') || (!$img_str)) {
if ((substr(Network::getCurl()->getCode(), 0, 1) == '4') || (!$img_str)) {
$img_str = file_get_contents('images/blank.png');
$mime = 'image/png';
$cachefile = ''; // Clear the cachefile so that the dummy isn't stored