X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=boot.php;h=e47665f94d072bc9772b9c01ace9b82d928cd46f;hb=f4707d03d97d9fb17e4ec0874f95992e270c933b;hp=8c3cd786f54dd5de79a074e143c528e77959aa0c;hpb=00d369a65df4bff9500690bbf11234aa0691664a;p=friendica.git diff --git a/boot.php b/boot.php index 8c3cd786f5..e47665f94d 100644 --- a/boot.php +++ b/boot.php @@ -29,6 +29,7 @@ use Friendica\Core\Worker; 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'; @@ -42,7 +43,7 @@ define('FRIENDICA_PLATFORM', 'Friendica'); define('FRIENDICA_CODENAME', 'Asparagus'); define('FRIENDICA_VERSION', '3.6-dev'); define('DFRN_PROTOCOL_VERSION', '2.23'); -define('DB_UPDATE_VERSION', 1238); +define('DB_UPDATE_VERSION', 1239); define('NEW_UPDATE_ROUTINE_VERSION', 1170); /** @@ -228,9 +229,10 @@ define('ACCOUNT_TYPE_COMMUNITY', 3); * Type of the community page * @{ */ -define('CP_NO_COMMUNITY_PAGE', -1); +define('CP_NO_COMMUNITY_PAGE', -1); define('CP_USERS_ON_SERVER', 0); define('CP_GLOBAL_COMMUNITY', 1); +define('CP_USERS_AND_GLOBAL', 2); /** * @} */ @@ -674,7 +676,7 @@ function check_db($via_worker) if ($build != DB_UPDATE_VERSION) { // When we cannot execute the database update via the worker, we will do it directly if (!Worker::add(PRIORITY_CRITICAL, 'DBUpdate') && $via_worker) { - update_db(get_app()); + update_db(); } } } @@ -695,11 +697,8 @@ function check_url(App $a) // and www.example.com vs example.com. // We will only change the url to an ip address if there is no existing setting - if (empty($url)) { - $url = Config::set('system', 'url', System::baseUrl()); - } - if ((!link_compare($url, System::baseUrl())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $a->get_hostname))) { - $url = Config::set('system', 'url', System::baseUrl()); + if (empty($url) || (!link_compare($url, System::baseUrl())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $a->get_hostname))) { + Config::set('system', 'url', System::baseUrl()); } return; @@ -709,7 +708,7 @@ function check_url(App $a) * @brief Automatic database updates * @param object $a App */ -function update_db(App $a) +function update_db() { $build = Config::get('system', 'build'); @@ -798,7 +797,6 @@ function run_update_function($x) Config::set('system', 'build', $x + 1); return true; } - return true; } /** @@ -877,83 +875,6 @@ function get_guid($size = 16, $prefix = "") } } -/** - * @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. */ @@ -969,13 +890,15 @@ function killme() /** * @brief Redirect to another URL and terminate this process. */ -function goaway($s) +function goaway($path) { - if (!strstr(normalise_link($s), "http://")) { - $s = System::baseUrl() . "/" . $s; + if (strstr(normalise_link($path), 'http://')) { + $url = $path; + } else { + $url = System::baseUrl() . '/' . ltrim($path, '/'); } - header("Location: $s"); + header("Location: $url"); killme(); } @@ -1124,7 +1047,6 @@ function current_theme() if ($is_mobile) { if (isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) { - $system_theme = $standard_system_theme; $theme_name = $standard_theme_name; } else { $system_theme = Config::get('system', 'mobile-theme', ''); @@ -1135,7 +1057,6 @@ function current_theme() if ($theme_name === '---') { // user has selected to have the mobile theme be the same as the normal one - $system_theme = $standard_system_theme; $theme_name = $standard_theme_name; if ($page_theme) { @@ -1144,7 +1065,6 @@ function current_theme() } } } else { - $system_theme = $standard_system_theme; $theme_name = $standard_theme_name; if ($page_theme) {