Example #1
0
function save_config($config_array = array())
{
    $curr_dir = dirname(__FILE__);
    if (!count($config_array) || !count($config_array['adminConfig'])) {
        return array('error' => 'Invalid config array');
    }
    $new_admin_config = '';
    foreach ($config_array['adminConfig'] as $admin_var => $admin_val) {
        $new_admin_config .= "\t\t'" . addslashes($admin_var) . "' => \"" . str_replace(array("\n", "\r", '"'), array('\\n', '\\r', '\\"'), $admin_val) . "\",\n";
    }
    $new_admin_config = substr($new_admin_config, 0, -2) . "\n";
    $new_config = "<?php\n" . "\t\$dbServer = '" . addslashes($config_array['dbServer']) . "';\n" . "\t\$dbUsername = '******'dbUsername']) . "';\n" . "\t\$dbPassword = '******'dbPassword']) . "';\n" . "\t\$dbDatabase = '" . addslashes($config_array['dbDatabase']) . "';\n" . "\n\t\$adminConfig = array(\n" . $new_admin_config . "\t);";
    if (detect_config(false)) {
        // attempt to back up config
        @copy($curr_dir . '/config.php', $curr_dir . '/config.bak.php');
    }
    if (!($fp = @fopen($curr_dir . '/config.php', 'w'))) {
        return array('error' => 'Unable to write to config file', 'config' => $new_config);
    }
    fwrite($fp, $new_config);
    fclose($fp);
    return true;
}
Example #2
0
if (!defined('maxSortBy')) {
    define('maxSortBy', 4);
}
if (!defined('empty_lookup_value')) {
    define('empty_lookup_value', '{empty_value}');
}
if (function_exists('date_default_timezone_set')) {
    @date_default_timezone_set('America/New_York');
}
if (function_exists('set_magic_quotes_runtime')) {
    @set_magic_quotes_runtime(0);
}
$GLOBALS['filter_operators'] = array('equal-to' => '<=>', 'not-equal-to' => '!=', 'greater-than' => '>', 'greater-than-or-equal-to' => '>=', 'less-than' => '<', 'less-than-or-equal-to' => '<=', 'like' => 'like', 'not-like' => 'not like', 'is-empty' => 'isEmpty', 'is-not-empty' => 'isNotEmpty');
$currDir = dirname(__FILE__);
include "{$currDir}/settings-manager.php";
detect_config();
migrate_config();
include "{$currDir}/config.php";
include "{$currDir}/db.php";
include "{$currDir}/ci_input.php";
include "{$currDir}/datalist.php";
include "{$currDir}/incCommon.php";
include "{$currDir}/admin/incFunctions.php";
ob_start();
/* trim $_POST, $_GET, $_REQUEST */
if (count($_POST)) {
    $_POST = array_trim($_POST);
}
if (count($_GET)) {
    $_GET = array_trim($_GET);
}