use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Database\DBStructure;
+use Friendica\Module\Login;
require_once 'include/network.php';
require_once 'include/plugin.php';
}
}
-/**
- * @brief Wrapper for adding a login box.
- *
- * @param bool $register If $register == true provide a registration link.
- * This will most always depend on the value of $a->config['register_policy'].
- * @param bool $hiddens optional
- *
- * @return string Returns the complete html for inserting into the page
- *
- * @hooks 'login_hook'
- * string $o
- */
-function login($register = false, $hiddens = false)
-{
- $a = get_app();
- $o = "";
- $reg = false;
- if ($register) {
- $reg = array(
- 'title' => t('Create a New Account'),
- 'desc' => t('Register')
- );
- }
-
- $noid = Config::get('system', 'no_openid');
-
- $dest_url = $a->query_string;
-
- if (local_user()) {
- $tpl = get_markup_template("logout.tpl");
- } else {
- $a->page['htmlhead'] .= replace_macros(
- get_markup_template("login_head.tpl"),
- array(
- '$baseurl' => $a->get_baseurl(true)
- )
- );
-
- $tpl = get_markup_template("login.tpl");
- $_SESSION['return_url'] = $a->query_string;
- $a->module = 'login';
- }
-
- $o .= replace_macros(
- $tpl,
- array(
- '$dest_url' => $dest_url,
- '$logout' => t('Logout'),
- '$login' => t('Login'),
-
- '$lname' => array('username', t('Nickname or Email: ') , '', ''),
- '$lpassword' => array('password', t('Password: '), '', ''),
- '$lremember' => array('remember', t('Remember me'), 0, ''),
-
- '$openid' => !$noid,
- '$lopenid' => array('openid_url', t('Or login using OpenID: '),'',''),
-
- '$hiddens' => $hiddens,
-
- '$register' => $reg,
-
- '$lostpass' => t('Forgot your password?'),
- '$lostlink' => t('Password Reset'),
-
- '$tostitle' => t('Website Terms of Service'),
- '$toslink' => t('terms of service'),
-
- '$privacytitle' => t('Website Privacy Policy'),
- '$privacylink' => t('privacy policy'),
- )
- );
-
- call_hooks('login_hook', $o);
-
- return $o;
-}
-
/**
* @brief Used to end the current process, after saving session state.
*/
}
}
-/**
- * @brief Kills the "Friendica" cookie and all session data
- */
-function nuke_session()
-{
- new_cookie(-3600); // make sure cookie is deleted on browser close, as a security measure
- session_unset();
- session_destroy();
-}
killme();
}
}
+
+/**
+ * @brief Kills the "Friendica" cookie and all session data
+ */
+function nuke_session()
+{
+ new_cookie(-3600); // make sure cookie is deleted on browser close, as a security measure
+ session_unset();
+ session_destroy();
+}
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';
function admin_content(App $a)
{
if (!is_site_admin()) {
- return login(false);
+ return Login::form();
}
if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Database\DBM;
+use Friendica\Module\Login;
require_once('include/api.php');
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);
use Friendica\App;
use Friendica\Core\System;
+use Friendica\Module\Login;
require_once('include/conversation.php');
require_once('include/items.php');
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;
}
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';
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'])));
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) {
$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);
+++ /dev/null
-<?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);
-}
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';
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
use Friendica\Core\NotificationsManager;
use Friendica\Core\System;
use Friendica\Database\DBM;
+use Friendica\Module\Login;
function notify_init(App $a) {
if (! local_user()) {
function notify_content(App $a) {
if (! local_user()) {
- return login();
+ return Login::form();
}
$nm = new NotificationsManager();
use Friendica\App;
use Friendica\Core\System;
+use Friendica\Module\Login;
function oexchange_init(App $a) {
function oexchange_content(App $a) {
if (! local_user()) {
- $o = login(false);
+ $o = Login::form();
return $o;
}
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');
$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");
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\User;
+use Friendica\Module\Login;
require_once 'include/enotify.php';
{
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;
}