예제 #1
0
파일: install.php 프로젝트: ajaboa/crmpuan
<?php

//echo "CONFIG: ".str_replace('<?php' ,'', file_get_contents('/var/www/trunk/config.php'));
require 'header.php';
$stmt = \GO::getDbConnection()->query("SHOW TABLES");
$hasTables = $stmt->rowCount() > 0;
if ($_SERVER['REQUEST_METHOD'] == "POST") {
    if (isset($_POST['upgrade'])) {
        redirect('upgrade.php');
    }
    if ($hasTables) {
        trigger_error("Installation aborted because the database is not empty!", E_USER_ERROR);
        exit;
    }
    if ($_POST['password1'] != $_POST['password2']) {
        \GO\Base\Html\Input::setError('password1', "The passwords didn't match");
    }
    \GO\Base\Html\Error::checkRequired();
    if (!\GO\Base\Html\Input::hasErrors()) {
        try {
            \GO::$ignoreAclPermissions = true;
            \GO\Base\Util\SQL::executeSqlFile('install.sql');
            $dbVersion = \GO\Base\Util\Common::countUpgradeQueries("updates.php");
            \GO::config()->save_setting('version', $dbVersion);
            \GO::config()->save_setting('upgrade_mtime', \GO::config()->mtime);
            $adminGroup = new \GO\Base\Model\Group();
            $adminGroup->id = 1;
            $adminGroup->name = \GO::t('group_admins');
            if (!$adminGroup->save()) {
                throw new \Exception("Could not save admin group");
            }
예제 #2
0
         }
         \GO::config()->file_storage_path = $f->path() . '/';
         $f = new \GO\Base\Fs\Folder($_POST['tmpdir']);
         if (!$f->exists() && !$f->create(0777)) {
             \GO\Base\Html\Input::setError("tmpdir", "Temporary folder doesn't exist. Please make sure it exists and it must be writable for the webserver user.");
         } elseif (!$f->isWritable()) {
             \GO\Base\Html\Input::setError("tmpdir", "Temporary folder must be writable for the webserver user.");
         }
         \GO::config()->tmpdir = $f->path() . '/';
         \GO::config()->save($config);
         if (!\GO\Base\Html\Input::hasErrors()) {
             redirect("regional.php");
         }
     }
 } catch (Exception $e) {
     \GO\Base\Html\Input::setError("form", $e->getMessage());
 }
 printHead();
 //check if config root_path matches the current Group-Office in case an /etc/groupoffice/config.php was found that conflicts with this installation.
 $filepath = str_replace("\\", "/", __FILE__);
 if (strpos($filepath, \GO::config()->root_path) !== 0) {
     errorMessage("WARNING: The config file {$configFile} was found but the root path points to another location " . \GO::config()->root_path . " while you are installing in " . dirname(dirname($filepath)) . " now. You probably want to create a new config.php file for this installation.");
 }
 if (!is_writable($configFile)) {
     echo '<h1>Config file not writable</h1>';
     echo '<p>The configuration file \'' . $configFile . '\' exists but is not writable. If you wish to make changes then you have to make \'' . $configFile . '\' writable during the configuration process.';
     echo '<br /><br />Correct this and click on continue.</p>';
     echo '<div class="cmd">$ chmod 666 ' . $configFile . '</div>';
 } else {
     echo '<h1>File storage</h1>';
     \GO\Base\Html\Input::printError("form");