Move login() to Login module
- Move nuke_session to include/security - Remove mod/login
This commit is contained in:
parent
d328345815
commit
2dc598ed5b
14 changed files with 33 additions and 122 deletions
|
@ -13,6 +13,7 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Database\DBStructure;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\Login;
|
||||
|
||||
require_once 'include/enotify.php';
|
||||
require_once 'include/text.php';
|
||||
|
@ -153,7 +154,7 @@ function admin_post(App $a)
|
|||
function admin_content(App $a)
|
||||
{
|
||||
if (!is_site_admin()) {
|
||||
return login(false);
|
||||
return Login::form();
|
||||
}
|
||||
|
||||
if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Module\Login;
|
||||
|
||||
require_once('include/api.php');
|
||||
|
||||
|
@ -87,8 +88,8 @@ function api_content(App $a)
|
|||
|
||||
if (!local_user()) {
|
||||
/// @TODO We need login form to redirect to this page
|
||||
notice( t('Please login to continue.') . EOL );
|
||||
return login(false,$request->get_parameters());
|
||||
notice(t('Please login to continue.') . EOL);
|
||||
return Login::form($a->query_string, false, $request->get_parameters());
|
||||
}
|
||||
//FKOAuth1::loginUser(4);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Module\Login;
|
||||
|
||||
require_once('include/conversation.php');
|
||||
require_once('include/items.php');
|
||||
|
@ -14,8 +15,8 @@ function bookmarklet_init(App $a)
|
|||
function bookmarklet_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
$o .= login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
|
||||
$o = '<h2>' . t('Login') . '</h2>';
|
||||
$o .= Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? false : true);
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\Login;
|
||||
use Friendica\Network\Probe;
|
||||
|
||||
require_once 'include/enotify.php';
|
||||
|
@ -481,15 +482,14 @@ function dfrn_request_content(App $a)
|
|||
if (!local_user()) {
|
||||
info(t("Please login to confirm introduction.") . EOL);
|
||||
/* setup the return URL to come back to this page if they use openid */
|
||||
$_SESSION['return_url'] = $a->query_string;
|
||||
return login();
|
||||
return Login::form();
|
||||
}
|
||||
|
||||
// Edge case, but can easily happen in the wild. This person is authenticated,
|
||||
// but not as the person who needs to deal with this request.
|
||||
if ($a->user['nickname'] != $a->argv[1]) {
|
||||
return login();
|
||||
notice(t("Incorrect identity currently logged in. Please login to <strong>this</strong> profile.") . EOL);
|
||||
return Login::form();
|
||||
}
|
||||
|
||||
$dfrn_url = notags(trim(hex2bin($_GET['dfrn_url'])));
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Module\Login;
|
||||
|
||||
if(! function_exists('home_init')) {
|
||||
function home_init(App $a) {
|
||||
|
@ -43,8 +44,8 @@ function home_content(App $a) {
|
|||
$o .= '<h1>'.((x($a->config,'sitename')) ? sprintf(t("Welcome to %s"), $a->config['sitename']) : "").'</h1>';
|
||||
}
|
||||
|
||||
$o .= Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1);
|
||||
|
||||
$o .= login(($a->config['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
|
||||
|
||||
call_hooks("home_content",$o);
|
||||
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\System;
|
||||
|
||||
function login_content(App $a) {
|
||||
if (x($_SESSION, 'theme')) {
|
||||
unset($_SESSION['theme']);
|
||||
}
|
||||
|
||||
if (x($_SESSION, 'mobile-theme')) {
|
||||
unset($_SESSION['mobile-theme']);
|
||||
}
|
||||
|
||||
if (local_user()) {
|
||||
goaway(System::baseUrl());
|
||||
}
|
||||
|
||||
return login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
|
||||
}
|
|
@ -11,6 +11,7 @@ use Friendica\Core\PConfig;
|
|||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Module\Login;
|
||||
|
||||
require_once 'include/conversation.php';
|
||||
require_once 'include/contact_widgets.php';
|
||||
|
@ -380,8 +381,7 @@ function networkConversation($a, $items, $mode, $update) {
|
|||
|
||||
function network_content(App $a, $update = 0) {
|
||||
if (!local_user()) {
|
||||
$_SESSION['return_url'] = $a->query_string;
|
||||
return login(false);
|
||||
return Login::form();
|
||||
}
|
||||
|
||||
/// @TODO Is this really necessary? $a is already available to hooks
|
||||
|
|
|
@ -4,6 +4,7 @@ use Friendica\App;
|
|||
use Friendica\Core\NotificationsManager;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Module\Login;
|
||||
|
||||
function notify_init(App $a) {
|
||||
if (! local_user()) {
|
||||
|
@ -45,7 +46,7 @@ function notify_init(App $a) {
|
|||
|
||||
function notify_content(App $a) {
|
||||
if (! local_user()) {
|
||||
return login();
|
||||
return Login::form();
|
||||
}
|
||||
|
||||
$nm = new NotificationsManager();
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Module\Login;
|
||||
|
||||
function oexchange_init(App $a) {
|
||||
|
||||
|
@ -17,7 +18,7 @@ function oexchange_init(App $a) {
|
|||
function oexchange_content(App $a) {
|
||||
|
||||
if (! local_user()) {
|
||||
$o = login(false);
|
||||
$o = Login::form();
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ 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');
|
||||
|
@ -102,7 +103,7 @@ function profile_content(App $a, $update = 0) {
|
|||
$hashtags = (x($_GET, 'tag') ? $_GET['tag'] : '');
|
||||
|
||||
if (Config::get('system','block_public') && (! local_user()) && (! remote_user())) {
|
||||
return login();
|
||||
return Login::form();
|
||||
}
|
||||
|
||||
require_once("include/bbcode.php");
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\Core\System;
|
|||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\Login;
|
||||
|
||||
require_once 'include/enotify.php';
|
||||
|
||||
|
@ -94,11 +95,9 @@ function regmod_content(App $a)
|
|||
{
|
||||
global $lang;
|
||||
|
||||
$_SESSION['return_url'] = $a->cmd;
|
||||
|
||||
if (!local_user()) {
|
||||
info(t('Please login.') . EOL);
|
||||
$o .= '<br /><br />' . login(($a->config['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
|
||||
$o .= '<br /><br />' . Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1);
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue