// require common stuff require_once ELAB_ROOT . 'inc/functions.php'; // i18n (gettext) if (isset($_SESSION['prefs']['lang'])) { $locale = $_SESSION['prefs']['lang'] . '.utf8'; } else { $locale = get_config('lang') . '.utf8'; } $domain = 'messages'; putenv("LC_ALL={$locale}"); $res = setlocale(LC_ALL, $locale); bindtextdomain($domain, ELAB_ROOT . "locale"); textdomain($domain); // END i18n // run the update script if we have the wrong schema version $update = new \Elabftw\Elabftw\Update(); // don't run it if we didn't run the update.php script yet if (!is_null(get_config('schema'))) { if (get_config('schema') < $update::REQUIRED_SCHEMA) { try { $_SESSION['infos'] = $update->runUpdateScript(); } catch (Exception $e) { $_SESSION['errors'] = $e->getMessage(); } } } $user = new \Elabftw\Elabftw\User(); // pages where you don't need to be logged in // reset.php is in fact app/reset.php but we use basename so... $nologin_arr = array('login.php', 'login-exec.php', 'register.php', 'register-exec.php', 'change-pass.php', 'reset.php'); if (!isset($_SESSION['auth']) && !in_array(basename($_SERVER['SCRIPT_FILENAME']), $nologin_arr)) {
$smtppass = get_config('smtp_password'); if (strlen($stamppass) > 0) { try { $stamppass = $crypto->decrypt($stamppass); } catch (Exception $e) { display_message('error', $e->getMessage()); } } if (strlen($smtppass) > 0) { try { $smtppass = $crypto->decrypt($smtppass); } catch (Exception $e) { display_message('error', $e->getMessage()); } } $update = new \Elabftw\Elabftw\Update(); try { $update->getUpdatesIni(); } catch (Exception $e) { display_message('error', $e->getMessage()); } if ($update->success === true) { // display current and latest version echo "<br><p>" . _('Installed version:') . " " . $update::INSTALLED_VERSION . " "; // show a little green check if we have latest version if (!$update->updateIsAvailable()) { echo "<img src='img/check.png' width='16px' length='16px' title='latest' style='position:relative;bottom:8px' alt='OK' />"; } // display latest version echo "<br>" . _('Latest version:') . " " . $update->getLatestVersion() . "</p>"; // if we don't have the latest version, show button redirecting to wiki