Source for file install.inc.php
Documentation is available at install.inc.php
* php functions for installation support
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* @author m2mtech <tech@m2m.at>
* @copyright 2007 m2m server software gmbh
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License Version 2
* @version $Id: install.inc.php 148 2007-09-07 16:02:29Z m2mtech $
* @link http://www.ea-geier.at/
* database functions for installation support
require_once('code/base/install.db.php');
* html functions for installation support
require_once('code/base/install.html.php');
* @param array basic configuration
$in->get['state'] = 'install';
$opt['db'] = array('mysqlt' => 'MySQL');
if (isset ($_POST['buttonInstall'])) {
$vars = array('p:abc:abc', 'p:txt:txt,pass', 'p:mail:mail');
$dsn = $post['abcDBType'] . '://' . $post['txtUser'] . ':' . $post['txtPass'] . '@' . $post['txtServer'] . '/' . $post['txtDB'];
$user = array('mail' => $post['mailAdmin'], 'pw' => $post['passAdmin'], 'name' => 'Admin');
$admin = $post['mailAdmin'];
if ($dbError) { // given database settings are wrong
$vars = array('abcDBType', 'txtUser', 'txtPass', 'txtServer', 'txtDB');
foreach ($vars as $var) $in->error[$var] = true;
$template = file('config/config.dist.php');
$vars = array('dsn' => 'driver://user:password@server/database', 'admin' => 'admin@ea-geier.at');
foreach ($vars as $var => $pattern)
$vars[$var] = '/' . preg_quote($pattern, '/') . '/';
foreach ($template as $line) { // parse file (simple comments are stripped)
if (($pos = strpos($line, '*/')) !== false) {
$line = substr($line, $pos + 2);
if (($pos = strpos($line, '/*')) !== false) {
$line = substr($line, 0, $pos);
if (($pos = strpos($line, '//')) !== false)
if (!preg_match('/\'.*\/\/.*\'||\".*\/\/.*\"/', $line)) {
$line = substr($line, 0, $pos);
if (!trim($line)) continue;
foreach ($vars as $var => $pattern)
if (isset ($file)) $post['configfile'] = $file;
if (!isset ($post['txtServer'])) $post['txtServer'] = 'localhost';
* check if smarty folders are available and configured correctly
while (false !== ($file = $dir->read()))
if (preg_match('/^[a-z]{2}$/', $file)) $lang[] = $file;
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>EA-Geier - Verzeichnisfehler</title><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body>';
foreach ($file as $line) if
$ini[$match[1]] = $match[2];
echo '<div style="float: left; padding: 1em;">' . $ini['pleasecheckfolders'] . '<br /><pre>';
foreach ($bad as $file) echo $file . '<br />';
echo '</pre>' . $ini['examplecheckfolders'] . '<br /><pre>'; echo 'cd <i>[' . $ini['patheageier'] . ']</i><br />';
foreach ($bad as $file) echo 'chmod 707 ' . $file . '<br />';
echo '</pre><hr /></div>';
* update system configuration
|