Ejemplo n.º 1
0
 /**
  * execute sql file with unit_test_table_prefix
  */
 public static function prepare($sql_setup_file)
 {
     ### prepare test database
     require_once dirname(__FILE__) . '/../_settings/db_settings.php';
     ### Create database ###
     ### included database handler ###
     $db_type = confGet('DB_TYPE');
     if (file_exists("../db/db_" . $db_type . "_class.php")) {
         require_once dirname(__FILE__) . "/../db/db_" . $db_type . "_class.php";
     } else {
         trigger_error("Datebase handler not found for db-type '{$db_type}'", E_USER_ERROR);
     }
     #$sql_obj = new sql_class($f_hostname, $f_db_username, $f_db_password, $f_db_name);
     require_once dirname(__FILE__) . '/../db/db.inc.php';
     ### trigger db request ###
     $dbh = new DB_Mysql();
     $sql_obj = $dbh->connect();
     if (!parse_mysql_dump($sql_setup_file, confGet('DB_TABLE_PREFIX_UNITTEST') . confGet('DB_TABLE_PREFIX'), $sql_obj)) {
         #trace("error");
         print "error setting up database structure";
         print "mySQL-Error[" . __LINE__ . "]:<pre>" . $sql_obj->error . "</pre>";
     }
 }
    echo "Successful <br>";
}
echo "Creating Config file.........";
$configfile = "config.php";
$writeconfig = fopen($configfile, 'w') or die("Cannot create/edit config File.");
$stringData = "<? \n";
fwrite($writeconfig, $stringData);
$stringData = "\$" . "dbhost = " . "'" . $dbhost . "'" . ";" . " \n";
fwrite($writeconfig, $stringData);
$stringData = "\$" . "dbname = " . "'" . $dbname . "'" . ";" . " \n";
fwrite($writeconfig, $stringData);
$stringData = "\$" . "dbuser = "******"'" . $dbuser . "'" . ";" . " \n";
fwrite($writeconfig, $stringData);
$stringData = "\$" . "dbpass = "******"'" . $dbpass . "'" . ";" . " \n";
fwrite($writeconfig, $stringData);
$stringData = "?>";
fwrite($writeconfig, $stringData);
fclose($writeconfig);
echo "Successful<br>";
echo "Running database Querys......";
$queryFile = 'SQL.sql.txt';
parse_mysql_dump($queryFile);
echo "<br/>Creating User.</br>";
$query = "INSERT INTO va_mailbox VALUES ('19','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','')";
mysql_query($query) or die("Unable to create Mailbox.");
$query = "INSERT INTO va_users VALUES ('','admin','" . md5($_POST['adminpass']) . "','','" . date("n.j.y") . "','5','1','1','1','0','100','1000','1000','1001','1001','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','19','10','10','10','10','200','5','3','3','0','0','0','0','0','0','0','0','0','0','0','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','0','','')";
mysql_query($query) or die("Unable to register account");
echo "Closing database.<br>";
mysql_close($testconnect);
echo "Voided Alliance has been successfully Installed";
echo "<br><br><b>Now delete install.php and installer.php for security and also the SQL.sql.txt.</b>";
Ejemplo n.º 3
0
<?php 
} elseif ($action == 'database_upload') {
    ?>
        <div class="bounder">
          <fieldset>
            <legend><?php 
    echo TEXT_LEGEND_DBASE_UPLOAD;
    ?>
</legend>
            <div class="splitColumn vmargin"><b><?php 
    echo TEXT_CONTENT_DATABASE_UPLOAD;
    ?>
</b></div>
            <div class="scrollContent" style="height: 400px; overflow: auto;">
<?php 
    parse_mysql_dump(FILE_I_METRICS_CMS_DBASE);
    ?>
            </div>
            <div class="innerContent" style="background: #F4FFF4"><h2><?php 
    echo TEXT_CONTENT_DATABASE_COMPLETE;
    ?>
</h2></div>
            <div style="cleaner"><form name="install_form" action="<?php 
    echo $_SERVER['SCRIPT_NAME'] . '?action=finish';
    ?>
" method="post">
              <div class="formButtons" style="text-align: right;">
                <div class="lalign"><input type="submit" title="<?php 
    echo BUTTON_INFO_DBASE_COMPLETE;
    ?>
" name="installation" value="<?php 
Ejemplo n.º 4
0
    </form>
    </div>

	<?php 
	mysql_close();
	}
	
	
	
	
}elseif($step==3){
	
	include($resourcesURL.'/config.php');
	$conn = @mysql_connect($dbhost,$dbuser,$dbpass);
	@mysql_select_db($dbname, $conn);
	parse_mysql_dump("data.sql");
	mysql_close();
?>
	<div class="install-err">
		Successful Install.
    </div>
    <div class="install-db-form">
    <form action="<?php echo $_SESSION["expURL"];?>" method="post">
      <input class="btn" type="submit" name="button" id="button" value="Back to the example" />
    </form>
    </div>
<?php
}else
{
	$_SESSION["expURL"] = $_SERVER['PHP_SELF'];
?>
Ejemplo n.º 5
0
    parse_mysql_dump("structure.sql", $db);
}
if ($update1_5) {
    parse_mysql_dump("convert_1_0_3_to_1_5_structure.sql", $db);
}
if ($update1_5_1) {
    parse_mysql_dump("convert_1_5_to_1_5_1_structure.sql", $db);
}
if ($update1_5_2) {
    parse_mysql_dump("convert_1_5_1_to_1_5_2_structure.sql", $db);
}
if ($new1_5_1) {
    parse_mysql_dump("structure_1_5_1.sql", $db);
}
if ($new1_5_2) {
    parse_mysql_dump("structure_1_5_2.sql", $db);
}
if (isset($_POST['mail'])) {
    $mail = 1;
} else {
    $mail = 0;
}
if (isset($_POST['sweet16Competition'])) {
    $sweet16Competition = 1;
} else {
    $mail = 0;
}
$_POST['title'] = str_replace("'", "''", $_POST['title']);
$_POST['subtitle'] = str_replace("'", "''", $_POST['subtitle']);
$meta = "INSERT INTO `meta` (`title`,`subtitle`,`name`,`cost`,`cut`,`cutType`,`email`,`sweet16`,`closed`,`rules`,`mail`,`sweet16Competition`,`region1`,`region2`,`region3`,`region4`,`db_version`) VALUES ('{$_POST['title']}','{$_POST['subtitle']}','{$_POST['adminname']}','{$_POST['cost']}','{$_POST['cut']}','{$_POST['cutType']}','{$_POST['email']}',0,0,'<p>No additional rules have been set.</p>','{$mail}','{$sweet16Competition}','{$_POST['region1name']}','{$_POST['region2name']}','{$_POST['region3name']}','{$_POST['region4name']}','{$dbschema_vers}')";
mysql_query($meta, $db) or die(mysql_error());
Ejemplo n.º 6
0
<?php

require_once '../../hibbity/dbinfo.php';
if ($_GET['do'] == 'db') {
    parse_mysql_dump('naranai.sql');
    echo 'Complete.';
    exit;
}
if ($_GET['do'] == 'colors') {
    parse_mysql_dump('colors.sql');
    echo 'Complete.';
    exit;
}
if ($_GET['do'] == 'settings') {
    if (!is_dir(SITE_DIR . '/feed_cache/')) {
        mkdir(SITE_DIR . '/feed_cache/', 0777);
    }
    if (!is_dir(SITE_DIR . '/images/')) {
        mkdir(SITE_DIR . '/images/', 0777);
    }
    if (!is_dir(SITE_DIR . '/thumbs/')) {
        mkdir(SITE_DIR . '/thumbs/', 0777);
    }
    $settings = array('permissions_upload' => 0, 'permissions_tag_edit' => 1, 'permissions_group_edit' => 1, 'permissions_image_edit' => 1, 'permissions_forum_view' => 0, 'permissions_forum_reply' => 1, 'permissions_forum_add' => 1);
    foreach ($settings as $name => $value) {
        $sql = "INSERT IGNORE INTO config (name, value) VALUES ('" . $name . "', '" . $value . "');";
        mysql_query($sql);
    }
    echo "Complete.";
    exit;
}
Ejemplo n.º 7
0
function install_step4()
{
    $INTEGRIA_config = "include/config.php";
    global $integria_footertext;
    global $integria_version;
    if (!isset($_POST["user"]) || !isset($_POST["dbname"]) || !isset($_POST["host"]) || !isset($_POST["pass"])) {
        $dbpassword = "";
        $dbuser = "";
        $dbhost = "";
        $dbname = "";
    } else {
        $dbpassword = $_POST["pass"];
        $dbuser = $_POST["user"];
        $dbhost = $_POST["host"];
        if (isset($_POST["demodb"])) {
            $demodb = $_POST["demodb"];
        } else {
            $demodb = 0;
        }
        if (isset($_POST["createdb"])) {
            $createdb = $_POST["createdb"];
        } else {
            $createdb = 0;
        }
        if (isset($_POST["createuser"])) {
            $createuser = $_POST["createuser"];
        } else {
            $createuser = 0;
        }
        $dbname = $_POST["dbname"];
        if (isset($_POST["url"])) {
            $url = $_POST["url"];
        } else {
            $url = '/integria';
        }
    }
    $everything_ok = 0;
    $step1 = 0;
    $step2 = 0;
    $step3 = 0;
    $step4 = 0;
    $step5 = 0;
    $step6 = 0;
    $step7 = 0;
    echo "\n\t<div align='center' class='mt35'>\n\t<div id='wizard' style=''>\n\t\t<div id='install_box' style='float: right;'>\n\t\t\t<h1>Creating database and default configuration file</h1>\n\t\t\t<table style='background: #ffffff;'>";
    if (!mysql_connect($dbhost, $dbuser, $dbpassword)) {
        check_generic(0, "Connection with Database");
    } else {
        check_generic(1, "Connection with Database");
        // Create schema
        if ($createdb == 1) {
            $step1 = mysql_query("CREATE DATABASE {$dbname}");
            check_generic($step1, "Creating database '{$dbname}'");
        } else {
            $step1 = 1;
        }
        if ($step1 == 1) {
            $step2 = mysql_select_db($dbname);
            check_generic($step2, "Opening database '{$dbname}'");
            $step3 = parse_mysql_dump("integria_db.sql");
            check_generic($step3, "Creating schema");
            // Populate the database with basic and optional demo data
            $step4 = parse_mysql_dump("integria_dbdata.sql");
            if ($step4 == 1 && $demodb == 1) {
                $step4 = parse_mysql_dump("integria_demo.sql");
            }
            check_generic($step4, "Populating database");
            $random_password = random_name(8);
            if ($createuser == 1) {
                $query = "GRANT ALL PRIVILEGES ON {$dbname}.* to integria@localhost  IDENTIFIED BY '" . $random_password . "'";
                $step5 = mysql_query($query);
                mysql_query("FLUSH PRIVILEGES");
                check_generic($step5, "Established privileges for user 'integria' on database '{$dbname}', with password <i>'{$random_password}'</i>");
            } else {
                $step5 = 1;
            }
            $step6 = is_writable("include");
            check_generic($step6, "Write permissions to save config file in './include'");
            $cfgin = fopen("include/config.inc.php", "r");
            $cfgout = fopen($INTEGRIA_config, "w");
            $config_contents = fread($cfgin, filesize("include/config.inc.php"));
            //---INIT--- CONFIG FILE
            $config_new = '<?php' . "\n" . '// Begin of automatic config file' . "\n" . '$config["dbuser"]='******'"integria";' . "\n" . '$config["dbpass"]="******";	// DB Password' . "\n";
            } else {
                $config_new = $config_new . '"' . $dbuser . '";' . "\n" . '$config["dbpass"]="******";	// DB Password' . "\n";
            }
            $config_new = $config_new . "\n" . '$config["dbname"]="' . $dbname . '";    // MySQL DataBase name' . "\n" . '$config["dbhost"]="' . $dbhost . '";    // DB Host' . "\n" . "\n" . '$config["baseurl"]="' . $url . '";	// Base URL' . "\n" . '$config["baseurl_static"]="' . $url . '";	// Don\'t  delete' . "\n" . '// End of automatic config file' . "\n" . '?>';
            //---END--- CONFIG FILE
            $step7 = fputs($cfgout, $config_new);
            $step7 = $step7 + fputs($cfgout, $config_contents);
            if ($step7 > 0) {
                $step7 = 1;
            }
            fclose($cfgin);
            fclose($cfgout);
            check_generic($step7, "Created new config file at '" . $INTEGRIA_config . "'");
        }
        mysql_select_db($dbname);
    }
    if ($step7 + $step6 + $step5 + $step4 + $step3 + $step2 + $step1 == 7) {
        $everything_ok = 1;
    }
    echo "</table></div>\n\t\t<div class='box' style='float: left;'>\n\t\t\t<img src='images/integria_white.png' alt=''>\n\t\t\t<br><br>\n\t\t\t<font size=1px>" . $integria_version . "</font>\n\t\t</div>\n\t\t\n\t\t<div class='box' style='float: left;'>\n\t\t\t<img src='images/step3.png' alt=''>\n\t\t</div>\n\t\t\n\t\t<div id='install_box' style='clear: both; margin-bottom: 25px;margin-left: 25px;'>\n\t\t\n\t\t<p>";
    if ($everything_ok == 1) {
        echo "<a href='install.php?step=5'><img align='right' src='images/arrow_next.png' class=''></a>";
    } else {
        echo "<img src='images/info.png'> You get some problems. Installation is not completed. \n\t\t\t<p>Please correct failures before trying again. All database schemes created in this step have been dropped.</p>";
        if (mysql_error() != "") {
            echo "<p><img src='images/info.png'> <b>ERROR:</b> " . mysql_error() . "</p>";
        }
        if ($createdb == 1) {
            mysql_query("DROP DATABASE {$dbname}");
        }
    }
    echo "</div>\n\t\t<div style='clear: both; width: 100%;'></div>\n\t\t</div></div>";
}
Ejemplo n.º 8
0
/**
* proceed with installation
* - returns true on success
*/
function step_02_proceed()
{
    global $g_form_fields, $sql_obj;
    echo "<h2>Proceeding...</h2>";
    $f_db_type = $g_form_fields['db_type']['value'];
    $f_hostname = $g_form_fields['hostname']['value'];
    $f_db_name = $g_form_fields['db_name']['value'];
    $f_db_username = $g_form_fields['db_username']['value'];
    $f_db_password = $g_form_fields['db_password']['value'];
    $f_db_table_prefix = $g_form_fields['db_table_prefix']['value'];
    $f_user_admin_name = $g_form_fields['user_admin_name']['value'];
    $f_user_admin_password = $g_form_fields['user_admin_password']['value'];
    $f_continue_on_sql_errors = $g_form_fields['continue_on_sql_errors']['value'];
    require_once dirname(__FILE__) . "/../db/db_" . $f_db_type . "_class.php";
    print_testStart("checking mysql connecting to '{$f_hostname}'...");
    $sql_obj = new sql_class($f_hostname, $f_db_username, $f_db_password, $f_db_name);
    if ($sql_obj->error == false) {
        # Connection DB
        if (!$sql_obj->connect()) {
            $hint = 'This could be a problem with incorrect setup of your sql-server. <a href="http://www.streber-pm.org/1176">Read more...</a>';
            print_testResult(RESULT_FAILED, "mySQL-Error[" . __LINE__ . "]:<pre>" . $sql_obj->error . "</pre><br>{$hint}");
            return false;
        } else {
            print_testResult(RESULT_GOOD, $sql_obj->error);
        }
    } else {
        print_testResult(RESULT_FAILED, $sql_obj->error);
        return false;
    }
    print_testStart("Make sure to not overwrite existing streber-db called '{$f_db_name}'");
    ### db does NOT exists ###
    if (!$sql_obj->selectdb()) {
        print_testResult(RESULT_GOOD, $sql_obj->error);
        ### create new database ###
        print_testStart("create database");
        if (!$sql_obj->execute("CREATE DATABASE IF NOT EXISTS {$f_db_name} charset utf8 COLLATE utf8_general_ci")) {
            print_testResult(RESULT_FAILED, "<pre>" . $sql_obj->error . "</pre>");
            return false;
        } else {
            if (!$sql_obj->selectdb()) {
                print_testResult(RESULT_FAILED, $sql_obj->error);
                return false;
            } else {
                print_testResult(RESULT_GOOD, 'Database ' . $f_db_name . ' created.');
            }
        }
    } else {
        print_testResult(RESULT_PROBLEM, "DB '{$f_db_name}' already exists");
        ### check version of existing database ###
        print_testStart("checking version of existing database");
        if ($sql_obj->execute("SELECT * FROM {$f_db_table_prefix}db \r\n           \t\tWHERE `updated` IS NULL ORDER BY `version` ASC")) {
            $count = 0;
            $db_version = NULL;
            $streber_version_required = NULL;
            while ($row = $sql_obj->fetchArray()) {
                $db_version = $row['version'];
                $streber_version_required = $row['version_streber_required'];
                $count++;
            }
            /**
             * there should be excactly one row with updated == NULL. Otherwise we a have a problem
             */
            if ($count < 1) {
                /* Ugh oh. Lets see if we can get the row with the highest
                   version instead. */
                print_testResult(RESULT_PROBLEM, "Streber has detected a problem with db-version but is attempting to work around it.\n");
                if ($sql_obj->execute("SELECT * FROM {$f_db_table_prefix}db ORDER BY `version` DESC LIMIT 1")) {
                    while ($row = $sql_obj->fetchArray()) {
                        $db_version = $row['version'];
                        $streber_version_required = $row['version_streber_required'];
                        $count++;
                    }
                }
                if ($count < 1) {
                    print_testResult(RESULT_FAILED, "Streber is unable to detect your current installed version.<br/>\n" . "You can work around this by manually adding this information to the db table in your Streber database.");
                    return false;
                }
                print_testResult(RESULT_PROBLEM, "Taking best guess at currently installed version.\n");
            }
            if ($count > 1) {
                /* Doh. It appears that our user is the victim of an installer bug
                 * found in older versions of Streber (we hope). */
                print_testResult(RESULT_PROBLEM, "Streber has detected a problem with db-version but is now fixing. Upgrade history lost.");
                $sql_obj->execute("TRUNCATE TABLE {$f_db_table_prefix}db");
                $sql_obj->execute("INSERT INTO {$f_db_table_prefix}db SET version = " . $db_version . ", version_streber_required = " . $streber_version_required . ", id = 1, updated = ");
            }
            if ($db_version < confGet('STREBER_VERSION')) {
                ### update ###
                print_testResult(RESULT_PROBLEM, "version is {$db_version}. Upgrading...");
                $result = upgrade(array('db_type' => $f_db_type, 'hostname' => $f_hostname, 'db_username' => $f_db_username, 'db_password' => $f_db_password, 'db_table_prefix' => $f_db_table_prefix, 'db_name' => $f_db_name, 'db_version' => $db_version, 'continue_on_sql_errors' => $f_continue_on_sql_errors));
                return $result;
            } else {
                if ($streber_version_required > confGet('STREBER_VERSION')) {
                    print_testResult(RESULT_PROBLEM, "version is {$db_version}. It's requires Version " . confGet('STREBER_VERSION') . " of Streber. Current Version is " . confGet('STREBER_VERSION') . ". Please download and install the latest version.");
                    return false;
                } else {
                    $filename = '../' . confGet('DIR_SETTINGS') . confGet('FILE_DB_SETTINGS');
                    print_testStart("writing configuration file '{$filename}'...");
                    $write_ok = writeSettingsFile($filename, array('DB_TYPE' => $f_db_type, 'HOSTNAME' => $f_hostname, 'DB_USERNAME' => $f_db_username, 'DB_PASSWORD' => $f_db_password, 'DB_TABLE_PREFIX' => $f_db_table_prefix, 'DB_NAME' => $f_db_name, 'DB_VERSION' => confGet('STREBER_VERSION')));
                    if ($write_ok) {
                        print_testResult(RESULT_GOOD, "Current database (version {$db_version}) looks fine. Installation finished with database setting rewritten to file. Please view " . getStreberWikiLink('installation', 'Installation Guide') . " on how to fix unsolved problems.");
                    } else {
                        print_testResult(RESULT_PROBLEM, "Current database (version {$db_version}) looks fine. Installation finished with no change (unable to rewrite database setting to file). Please view " . getStreberWikiLink('installation', 'Installation Guide') . " on how to fix unsolved problems.");
                    }
                    return true;
                }
            }
            print_testResult(RESULT_PROBLEM, "Installation aborted due to unknown reason.");
            return false;
        } else {
            print_testResult(RESULT_GOOD, "Could not query streber-db version. Assuming fresh installation");
        }
    }
    /**
     * fresh installation
     */
    ### creating database-structure ###
    print_testStart("creating table structure...");
    $filename = "./create_structure_v" . confGet('DB_CREATE_DUMP_VERSION') . ".sql";
    $upgradeFromVersion = confGet('DB_CREATE_DUMP_VERSION');
    if (!file_exists($filename)) {
        $filenames = glob("./create_structure_v*.sql");
        if ($filenames) {
            rsort($filenames);
            print_testResult(RESULT_PROBLEM, "Required file {$filename} is missing, trying to use {$filenames['0']} instead and then upgrade.");
            $filename = $filenames[0];
            preg_match("/create_structure_v(.*)\\.sql/", $filename, $matches);
            $upgradeFromVersion = $matches[1];
        } else {
            print_testResult(RESULT_FAILED, "Getting sql-code failed. This is an internal error. Look at " . getStreberWikiLink('installation', 'Installation Guide') . " for clues. ");
            return false;
        }
    }
    if (!parse_mysql_dump($filename, $f_db_table_prefix, $sql_obj)) {
        print_testResult(RESULT_FAILED, "SQL-Error[" . __LINE__ . "]:<br><pre>" . $sql_obj->error . "</pre>");
        return false;
    }
    print_testResult(RESULT_GOOD);
    ### upgrade
    if ($upgradeFromVersion != confGet('STREBER_VERSION')) {
        print_testStart("updating to latest version...");
        $result = upgrade(array('db_type' => $f_db_type, 'hostname' => $f_hostname, 'db_username' => $f_db_username, 'db_password' => $f_db_password, 'db_table_prefix' => $f_db_table_prefix, 'db_name' => $f_db_name, 'continue_on_sql_errors' => $f_continue_on_sql_errors, 'db_version' => $upgradeFromVersion));
        if (!$result) {
            print_testResult(RESULT_FAILED, "Upgrading failed. This is an internal error. Look at " . getStreberWikiLink('installation', 'Installation Guide') . " for clues. ");
            return false;
        }
        print_testResult(RESULT_GOOD);
    }
    ### create db-version entry ###
    print_testStart("add db-version entry");
    $db_version = confGet('STREBER_VERSION');
    $streber_version_required = confGet('STREBER_VERSION');
    $str_query = "INSERT into {$f_db_table_prefix}db (id,version,version_streber_required,created) VALUES(1,'{$db_version}','{$streber_version_required}',NOW() )";
    if (!$sql_obj->execute($str_query)) {
        print_testResult(RESULT_FAILED, "SQL-Error[" . __LINE__ . "]:<pre>" . $sql_obj->error . "</pre>");
        return false;
    } else {
        print_testResult(RESULT_GOOD);
    }
    ### create admin entry entry ###
    print_testStart("add admin-user entry 1/2");
    $password_md5 = md5($f_user_admin_password);
    $str_query = "INSERT into {$f_db_table_prefix}person\r\n                          (id,\r\n                          name,\r\n                          nickname,\r\n                          password,\r\n                          user_rights,\r\n                          can_login,\r\n                          profile,\r\n                          language,\r\n                          ip_address,\r\n                          office_email\r\n                          )\r\n                          VALUES(\r\n                          1,\r\n                          '{$f_user_admin_name}',\r\n                          '{$f_user_admin_name}',\r\n                          '{$password_md5}',\r\n                          268435455, /* all rights */\r\n                          1,\r\n                          1,\r\n                          '" . confGet('DEFAULT_LANGUAGE') . "',\r\n                          '',\r\n                          '" . $g_form_fields["site_email"]["value"] . "'\r\n                          )";
    if (!$sql_obj->execute($str_query)) {
        print_testResult(RESULT_FAILED, "SQL-Error[" . __LINE__ . "]:<br><pre>" . $sql_obj->error . "</pre>");
        return false;
    } else {
        print_testResult(RESULT_GOOD);
    }
    ### create admin entry entry ###
    print_testStart("add admin-user entry 2/2");
    $str_query = "INSERT into {$f_db_table_prefix}item\r\n                          (id,\r\n                          type,\r\n                          state,\r\n                          created_by,\r\n                          modified_by\r\n                          )\r\n                          VALUES(\r\n                          1,\r\n                          " . ITEM_PERSON . ",\r\n                          " . ITEM_STATE_OK . ",\r\n                          1,\r\n                          1\r\n                          )";
    if (!$sql_obj->execute($str_query)) {
        print_testResult(RESULT_FAILED, "SQL-Error[" . __LINE__ . "]:<br><pre>" . $sql_obj->error . "</pre>");
        return false;
    } else {
        print_testResult(RESULT_GOOD);
    }
    ### settings-directory already exists? ###
    if (!file_exists('../' . confGet('DIR_SETTINGS'))) {
        print_testStart("try to create " . confGet('DIR_SETTINGS') . "...");
        if (!mkdir('../' . confGet('DIR_SETTINGS'))) {
            print_testResult(RESULT_FAILED, "could not create directory. This could be a file permission problem...");
        } else {
            print_testResult(RESULT_GOOD);
        }
    }
    /* Write general site settings */
    $filename = "../" . confGet("DIR_SETTINGS") . confGet("SITE_SETTINGS");
    print_testStart("writing configuration file '" . $filename . "'...");
    $settings = array("APP_NAME" => $g_form_fields["site_name"]["value"], "EMAIL_ADMINISTRATOR" => $g_form_fields["site_email"]["value"], 'APP_TITLE_HEADER' => $g_form_fields["site_name"]["value"] . "<span class=extend>PM</span>");
    $write_ok = writeSettingsFile($filename, $settings);
    if (!$write_ok) {
        print_testResult(RESULT_FAILED, "can not write '" . $filename . "'. Please create it with this content:<br><pre>&lt;?php" . buildSettingsFile($settings) . "?&gt;</pre>");
        return false;
    } else {
        print_testResult(RESULT_GOOD);
    }
    /* Write database settings */
    $filename = '../' . confGet('DIR_SETTINGS') . confGet('FILE_DB_SETTINGS');
    print_testStart("writing configuration file '{$filename}'...");
    $settings = array('DB_TYPE' => $f_db_type, 'HOSTNAME' => $f_hostname, 'DB_USERNAME' => $f_db_username, 'DB_PASSWORD' => $f_db_password, 'DB_TABLE_PREFIX' => $f_db_table_prefix, 'DB_NAME' => $f_db_name, 'DB_VERSION' => confGet('STREBER_VERSION'));
    $write_ok = writeSettingsFile($filename, $settings);
    if (!$write_ok) {
        print_testResult(RESULT_FAILED, "can not write '{$filename}'. Please create it with this content:<br><pre>&lt;?php" . buildSettingsFile($settings) . "?&gt;</pre>");
        return false;
    } else {
        print_testResult(RESULT_GOOD);
    }
    ### tmp-directory already exists? ###
    if (!file_exists('../' . confGet('DIR_TEMP'))) {
        print_testStart("try to create directory of tempory files " . confGet('DIR_TEMP') . "...");
        if (!mkdir('../' . confGet('DIR_TEMP'))) {
            print_testResult(RESULT_FAILED, "could not create directory. This could be a file permission problem...");
        } else {
            print_testResult(RESULT_GOOD);
        }
    }
    return true;
}