Esempio n. 1
0
function createDB()
{
    // check if the application.xml is writable
    $app_xml = OPENBIZ_APP_PATH . '/application.xml';
    if (!is_writable($app_xml)) {
        echo "ERROR: please give file {$app_xml} write permission to web server user. Example of linux command: chmod a+w {$app_xml}";
        exit;
    }
    $conn = connectDB(true);
    try {
        $conn->exec("CREATE DATABASE " . $_REQUEST['dbName']);
    } catch (Exception $e) {
        echo 'ERROR: ' . $e->getMessage();
        exit;
    }
    unset($conn);
    $conn = connectDB();
    if (!$conn) {
        echo 'ERROR: Unable to create Database!';
        return;
    }
    replaceDbConfig();
    echo 'SUCCESS: Database ' . $_REQUEST['dbName'] . ' is created';
}
    $lang = 'en';
}
require_once dirname(dirname(__FILE__)) . '/language/' . $lang . '.php';
// response ajax call
if ($isInstalled == false) {
    if (isset($_REQUEST['action']) && !$isInstalled) {
        if ($_REQUEST['action'] == 'create_db') {
            createDB();
            exit;
        }
        if ($_REQUEST['action'] == 'load_modules') {
            loadModules();
            exit;
        }
        if ($_REQUEST['action'] == 'replace_db_cfg') {
            replaceDbConfig();
            exit;
        }
    }
}
$stepArr = array("", "System Check", "Database Configuration", "Application Configuration", "Finish");
$step = isset($_REQUEST['step']) ? $_REQUEST['step'] : '0';
if ($isInstalled) {
    $step = count($stepArr) - 1;
}
if ((int) $step > 0 && (int) $step < count($stepArr) - 1) {
    $progress_bar = "<ul class=\"progress_bar\">";
    for ($i = 0; $i < count($stepArr); $i++) {
        if ($stepArr[$i]) {
            $text = $i . ". " . $stepArr[$i];
            if ($i > $step) {
Esempio n. 3
0
            }
        }
        if (isset($_REQUEST['load_db'])) {
            if (!fillDB()) {
                echo 'ERROR: Data was not populated into database.';
                exit;
            }
        }
        if (isset($_REQUEST['loadsip_db'])) {
            if (!siremisFillDB()) {
                echo 'ERROR: Data was not populated into SIP database.';
                exit;
            }
        }
        if (isset($_REQUEST['replace_db'])) {
            if (!replaceDbConfig()) {
                echo 'ERROR: Database config was not updated.';
                exit;
            }
            if (!siremisReplaceDbConfig()) {
                echo 'ERROR: Database config was not replaced.';
                exit;
            }
        }
        echo 'SUCCESS - actions completed, wait one second ...';
        exit;
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
Esempio n. 4
0
function fillDB()
{
    include_once MODULE_PATH . "/system/lib/ModuleLoader.php";
    replaceDbConfig();
    $modules = array('system', 'menu');
    foreach (glob(MODULE_PATH . DIRECTORY_SEPARATOR . "*") as $dir) {
        $modName = str_replace(MODULE_PATH . DIRECTORY_SEPARATOR, "", $dir);
        if ($modName != "system" && $modName != "menu") {
            array_push($modules, $modName);
        }
    }
    // find all modules
    foreach ($modules as $mod) {
        $loader = new ModuleLoader($mod);
        $loader->debug = 0;
        $loader->loadModule(true);
    }
    // admin to access all actions
    giveActionAccess("", 1);
    // sipadmin to access siremis user profile and sip admin pages
    giveActionAccess("module='user' OR module='ser'", 2);
    // sipuser to access siremis user profile and sip user pages
    giveActionAccess("module='user' OR module='sipuser'", 3);
    return true;
}