X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=boot.php;h=0692e8475781d1b3844a92dec1da64e673ff9813;hb=c4d3ab68785122ff070c65a444aaa0833b746b2b;hp=2c4bce9c85bd53b4bf35782ea423ebd8b51d9b33;hpb=04589ecd38d85df339a3fed320d2822520b686f2;p=friendica.git diff --git a/boot.php b/boot.php index 2c4bce9c85..0692e84757 100644 --- a/boot.php +++ b/boot.php @@ -36,14 +36,12 @@ require_once 'include/plugin.php'; require_once 'include/text.php'; require_once 'include/datetime.php'; require_once 'include/pgettext.php'; -require_once 'include/nav.php'; -require_once 'include/identity.php'; 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', 1242); define('NEW_UPDATE_ROUTINE_VERSION', 1170); /** @@ -289,7 +287,7 @@ define('NETWORK_PHANTOM', 'unkn'); // Place holder * and existing allocations MUST NEVER BE CHANGED * OR RE-ASSIGNED! You may only add to them. */ -$netgroup_ids = array( +$netgroup_ids = [ NETWORK_DFRN => (-1), NETWORK_ZOT => (-2), NETWORK_OSTATUS => (-3), @@ -311,7 +309,7 @@ $netgroup_ids = array( NETWORK_PNUT => (-20), NETWORK_PHANTOM => (-127), -); +]; /** * Maximum number of "people who like (or don't like) this" that we will list by name @@ -505,7 +503,7 @@ function startup() ini_set('pcre.backtrack_limit', 500000); if (get_magic_quotes_gpc()) { - $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); + $process = [&$_GET, &$_POST, &$_COOKIE, &$_REQUEST]; while (list($key, $val) = each($process)) { foreach ($val as $k => $v) { unset($process[$key][$k]); @@ -664,7 +662,7 @@ function check_db($via_worker) $build = Config::get('system', 'build'); if (empty($build)) { - Config::set('system', 'build', DB_UPDATE_VERSION); + Config::set('system', 'build', DB_UPDATE_VERSION - 1); $build = DB_UPDATE_VERSION; } @@ -676,7 +674,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(); } } } @@ -697,11 +695,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; @@ -711,13 +706,13 @@ 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'); - if (empty($build)) { - Config::set('system', 'build', DB_UPDATE_VERSION); - $build = DB_UPDATE_VERSION; + if (empty($build) || ($build > DB_UPDATE_VERSION)) { + $build = DB_UPDATE_VERSION - 1; + Config::set('system', 'build', $build); } if ($build != DB_UPDATE_VERSION) { @@ -792,15 +787,14 @@ function run_update_function($x) return false; } else { Config::set('database', 'update_' . $x, 'success'); - Config::set('system', 'build', $x + 1); + Config::set('system', 'build', $x); return true; } } else { Config::set('database', 'update_' . $x, 'success'); - Config::set('system', 'build', $x + 1); + Config::set('system', 'build', $x); return true; } - return true; } /** @@ -822,11 +816,11 @@ function check_plugins(App $a) if (DBM::is_result($r)) { $installed = $r; } else { - $installed = array(); + $installed = []; } $plugins = Config::get('system', 'addon'); - $plugins_arr = array(); + $plugins_arr = []; if ($plugins) { $plugins_arr = explode(',', str_replace(' ', '', $plugins)); @@ -834,7 +828,7 @@ function check_plugins(App $a) $a->plugins = $plugins_arr; - $installed_arr = array(); + $installed_arr = []; if (count($installed)) { foreach ($installed as $i) { @@ -971,7 +965,7 @@ function notice($s) { $a = get_app(); if (!x($_SESSION, 'sysmsg')) { - $_SESSION['sysmsg'] = array(); + $_SESSION['sysmsg'] = []; } if ($a->interactive) { $_SESSION['sysmsg'][] = $s; @@ -994,7 +988,7 @@ function info($s) } if (!x($_SESSION, 'sysmsg_info')) { - $_SESSION['sysmsg_info'] = array(); + $_SESSION['sysmsg_info'] = []; } if ($a->interactive) { $_SESSION['sysmsg_info'][] = $s; @@ -1015,7 +1009,7 @@ function get_max_import_size() function current_theme() { - $app_base_themes = array('duepuntozero', 'dispy', 'quattro'); + $app_base_themes = ['duepuntozero', 'dispy', 'quattro']; $a = get_app(); @@ -1051,7 +1045,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', ''); @@ -1062,7 +1055,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) { @@ -1071,7 +1063,6 @@ function current_theme() } } } else { - $system_theme = $standard_system_theme; $theme_name = $standard_theme_name; if ($page_theme) { @@ -1246,10 +1237,10 @@ function explode_querystring($query) $args = array_values($args); } - return array( + return [ 'base' => $base, 'args' => $args, - ); + ]; } /** @@ -1579,7 +1570,7 @@ function infinite_scroll_data($module) $reload_uri .= "&offset=" . urlencode($a->page_offset); } - $arr = array("pageno" => $pageno, "reload_uri" => $reload_uri); + $arr = ["pageno" => $pageno, "reload_uri" => $reload_uri]; return $arr; }