Skip to content

Commit 4ab377e

Browse files
committed
Secured installer so that it is disabled by default. You now have to rename the installer.disabled file to installer.enabled in order for the installer to work.
1 parent e3b730b commit 4ab377e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

installer.disabled

Whitespace-only changes.

installer.php

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<?php
2+
// Change this
23
require_once('PEAR.php');
4+
if ( !file_exists('installer.enabled') ){
5+
die("The installer is currently disabled. To enable it, please rename the 'installer.disabled' file to 'installer.enabled'. You can find this file inside the root xataface directory.");
6+
7+
}
8+
39
if ( !defined('FILE_APPEND') ){
410
define('FILE_APPEND', 1);
511
}
@@ -409,6 +415,9 @@ function db2app__process($values){
409415
}
410416

411417
function test_db_access($dbname, $username, $password){
418+
if ( !function_exists('xf_db_connect') ){
419+
require_once 'xf/db/drivers/'.basename(XF_DB_DRIVER).'.php';
420+
}
412421
$db = @xf_db_connect(DB_HOST, $username, $password);
413422
if ( !$db ){
414423
return PEAR::raiseError("Could not connect to the MySQL server with username $username.");
@@ -503,11 +512,14 @@ function testftp(){
503512
//print_r($_SERVER);
504513
function db(){
505514
static $db=-1;
506-
if ( $db == -1 ){
515+
if ( $db === -1 ){
507516
$installer = new Dataface_Installer;
508517
if (!@$_SERVER['PHP_AUTH_USER'] || !$_COOKIE['logged_in'] ){
509518
$installer->authenticate();
510519
}
520+
if ( !function_exists('xf_db_connect') ){
521+
require_once 'xf/db/drivers/'.basename(XF_DB_DRIVER).'.php';
522+
}
511523
$db = @xf_db_connect(DB_HOST,@$_SERVER['PHP_AUTH_USER'], @$_SERVER['PHP_AUTH_PW']);
512524
if ( !$db ){
513525
$installer->authenticate();

0 commit comments

Comments
 (0)