$continue = false;
         $errors .= TR_CONFIG_DATABASE_ERROR_CANTCONNECT;
     }
     if ($continue) {
         $status = $newdb->testPrivileges();
         foreach ($status as $type => $flag) {
             if (!$flag) {
                 $continue = false;
                 $errors .= sprintf(TR_CONFIG_DATABASE_ERROR_PERMDENIED, $type);
             }
         }
     }
 }
 $template = new template('administrationmodule', '_config_results');
 if ($continue) {
     pathos_config_saveConfiguration($_POST);
     $ob = "";
     if ($user->is_admin == 1) {
         pathos_lang_loadDictionary('standard', 'dbrecover');
         $db = $newdb;
         ob_start();
         include_once BASE . 'modules/administrationmodule/actions/installtables.php';
         $ob = ob_get_contents();
         ob_end_clean();
         if ($db->tableIsEmpty('user')) {
             $user = null;
             $user->username = '******';
             $user->password = md5('admin');
             $user->is_admin = 1;
             $user->is_acting_admin = 1;
             $db->insertObject($user, 'user');
        $section->name = "Home";
        $section->public = 1;
        $section->active = 1;
        $section->rank = 0;
        $section->parent = 0;
        $sid = $db->insertObject($section, "section");
    }
    echoSuccess();
}
if ($passed) {
    echoStart("Saving Configuration");
    $values = array("c" => $config, "opts" => array(), "configname" => "Default", "activate" => 1);
    if (!defined("SYS_CONFIG")) {
        require_once BASE . "subsystems/config.php";
    }
    pathos_config_saveConfiguration($values);
    // ERROR CHECKING
    echoSuccess();
}
?>
</table>
<?php 
if ($passed) {
    // Do some final cleanup
    foreach ($db->getTables() as $t) {
        // FIX table prefix problem
        if (substr($t, 0, 14 + strlen($db->prefix)) == $db->prefix . "installer_test") {
            $db->dropTable(str_replace($db->prefix, "", $t));
        }
    }
    ?>
Beispiel #3
0
 $used = array(CORE_EXT_MODULE => array(), CORE_EXT_SUBSYSTEM => array(), CORE_EXT_THEME => array());
 foreach (pathos_core_resolveDependencies(null, CORE_EXT_SYSTEM, $core->path) as $d) {
     if (!in_array($d['name'], $used[$d['type']])) {
         $extension->name = $d['name'];
         $extension->type = $d['type'];
         $db->insertObject($extension, "sharedcore_extension");
         $used[$d['type']][] = $d['name'];
     }
 }
 pathos_sharedcore_link($core, $site, $used);
 // Save database config.
 $values = array("c" => array("db_engine" => $_POST['db_engine'], "db_name" => $_POST['db_name'], "db_user" => $_POST['db_user'], "db_pass" => $_POST['db_pass'], "db_host" => $_POST['db_host'], "db_port" => $_POST['db_port'], "db_table_prefix" => $_POST['db_table_prefix']), "opts" => array(), "activate" => 1, "configname" => "Default");
 if (!defined("SYS_CONFIG")) {
     require_once BASE . "subsystems/config.php";
 }
 pathos_config_saveConfiguration($values, $site->path);
 // Install database for base system
 $newdb = pathos_database_connect($_POST['db_user'], $_POST['db_pass'], $_POST['db_host'] . ':' . $_POST['db_port'], $_POST['db_name'], $_POST['db_engine'], true);
 $newdb->prefix = $_POST['db_table_prefix'] . '_';
 // Following code snipped from modules/administrationmodule/actions/installtables.php
 $dir = $site->path . "datatypes/definitions";
 if (is_readable($dir)) {
     $tables = array();
     $dh = opendir($dir);
     while (($file = readdir($dh)) !== false) {
         if (is_readable("{$dir}/{$file}") && is_file("{$dir}/{$file}") && substr($file, -4, 4) == ".php" && substr($file, -9, 9) != ".info.php") {
             $tablename = substr($file, 0, -4);
             $dd = (include "{$dir}/{$file}");
             $info = null;
             if (is_readable("{$dir}/{$tablename}.info.php")) {
                 $info = (include "{$dir}/{$tablename}.info.php");