Please tell your administrator. If you are the administrator, you may want to check for / file a bug report.');
}
// Check that PHP version is sufficient
if (version_compare(PHP_VERSION, MIN_PHP_VERSION, '<')) {
$title = 'PHP ' . MIN_PHP_VERSION . ' is required';
$content = '
'.tr("Please contact your system administrator ( if you are not the one ;) ). Your version: ") . PHP_VERSION . '
' . '
';
createPage($title, $content);
}
// if tiki installer is locked (probably after previous installation) display notice
if (file_exists($lockFile)) {
$title = 'Tiki Installer Disabled';
$td = empty($tikidomain) ? '' : '/' . $tikidomain;
$content = '
'.tr("As a security precaution, the Tiki Installer has been disabled. To re-enable the installer:").'
'.tr('Use your file manager application to find the directory where you have unpacked your Tiki and remove the lock file which was created in the db folder').'.
';
createPage($title, $content);
}
if (! empty($db) && ! $db->getOne("SELECT COUNT(*) FROM `information_schema`.`character_sets` WHERE `character_set_name` = 'utf8mb4';")) {
die(tr('Your database does not support the utf8mb4 character set required in Tiki19 and above. You need to upgrade your mysql or mariadb installation.'));
}
$tikiroot = str_replace('\\', '/', dirname($_SERVER['PHP_SELF']));
$session_params = session_get_cookie_params();
session_set_cookie_params($session_params['lifetime'], $tikiroot);
unset($session_params);
session_start();
$rootcheck = empty($tikiroot) || $tikiroot === '/' ? '' : $tikiroot;
$refered = isset($_SERVER['HTTP_REFERER']) ? strpos($_SERVER['HTTP_REFERER'], $rootcheck . '/tiki-install.php') : false;
if (! $refered || ($refered && ! isset($_POST['install_step']))) {
unset($_SESSION['accessible']);
}
// Were database details defined before? If so, load them
if (file_exists('db/' . $tikidomainslash . 'local.php')) {
include 'db/' . $tikidomainslash . 'local.php';
// In case of replication, ignore it during installer.
unset($shadow_dbs, $shadow_user, $shadow_pass, $shadow_host);
// check for provided login details and check against the old, saved details that they're correct
if (isset($_POST['dbuser'], $_POST['dbpass'])) {
if (($_POST['dbuser'] == $user_tiki) && ($_POST['dbpass'] == $pass_tiki)) {
$_SESSION['accessible'] = true;
unset($_POST['dbuser']);
unset($_POST['dbpass']);
if (file_exists($authAttemptsFile)) {
unlink($authAttemptsFile);
}
} else {
$attempts = (int) @file_get_contents($authAttemptsFile);
if (++$attempts >= 10) {
touch($lockFile);
unlink($authAttemptsFile);
} else {
file_put_contents($authAttemptsFile, $attempts);
}
}
}
} else {
// No database info found, so it's a first-install and thus installer is accessible
$_SESSION['accessible'] = true;
}
if (isset($_SESSION['accessible'])) {
// allowed to access installer, include it
$logged = true;
$admin_acc = 'y';
include_once 'installer/tiki-installer.php';
} else {
// Installer knows db details but no login details were received for this script.
// Thus, display a form.
$title = tr('Tiki Installer Security Precaution');
$content = '
'.tr('You are attempting to run the Tiki Installer. For your protection, this installer can be used only by a site administrator.To verify that you are a site administrator, enter your database credentials (database username and password) here.').'
'.tr('If you have forgotten your database credentials, find the directory where you have unpacked your Tiki and have a look inside the db folder into the local.php file.').'
';
createPage($title, $content);
}
/**
* creates the HTML page to be displayed.
*
* Tiki may not have been installed when we reach here, so we can't use our templating system yet.
*
* @param string $title page Title
* @param mixed $content page Content
*/
function createPage($title, $content)
{
echo <<$title