Ejemplo n.º 1
0
function save_config($type = 'ini')
{
    global $INI;
    $q = ZSystem::GetSaveINI($INI);
    if (strtoupper($type) == 'INI') {
        if (!is_writeable(SYS_INIFILE)) {
            return false;
        }
        return write_ini_file($q, SYS_INIFILE);
    }
    if (strtoupper($type) == 'PHP') {
        if (!is_writeable(SYS_PHPFILE)) {
            return false;
        }
        return write_php_file($q, SYS_PHPFILE);
    }
    return false;
}
Ejemplo n.º 2
0
function save_config($type = 'ini')
{
    global $INI;
    $q = array('db' => $INI['db'], 'memcache' => $INI['memcache']);
    if (strtoupper($type) == 'INI') {
        if (!is_writeable(SYS_INIFILE)) {
            return false;
        }
        return write_ini_file($q, SYS_INIFILE);
    }
    if (strtoupper($type) == 'PHP') {
        if (!is_writeable(SYS_PHPFILE)) {
            return false;
        }
        return write_php_file($q, SYS_PHPFILE);
    }
    return false;
}
Ejemplo n.º 3
0
    Session::Set('error', 'static/user/ Write Forbidden');
    Utility::Redirect('install.php');
}
if (!$m) {
    Session::Set('error', 'Database setting is not correct');
    Utility::Redirect('install.php');
}
if (!mysql_select_db($db['name'], $m) && !mysql_query("CREATE database `{$db['name']}`;", $m)) {
    Session::Set('error', "Choose Database {$db['name']} Error, is it available?");
    Utility::Redirect('install.php');
}
mysql_select_db($db['name'], $m);
$dir = dirname(__FILE__);
$sql = '';
$f = file('./include/configure/db.sql');
foreach ($f as $l) {
    if (strpos(trim($l), '--') === 0 || strpos(trim($l), '/*') === 0 || !trim($l)) {
        continue;
    }
    $sql .= $l;
}
mysql_query("SET names UTF8;");
$sqls = explode(';', $sql);
foreach ($sqls as $sql) {
    mysql_query($sql, $m);
}
$PHP = array('db' => $db);
if (write_php_file($PHP, SYS_PHPFILE)) {
    Session::Set('notice', 'Installation is done, for security reason please delete install.php!');
}
Utility::Redirect('index.php');
Ejemplo n.º 4
0
    } else {
        fprintf(STDERR, "Error, path: %s\n", $item->getFilename());
    }
    $source = parse_url($frontmatter['x-source']);
    $source_path = $source['path'];
    $rewrite_ar[$source_path] = $dest_path;
    $rewrite_map[] = "{$source_path}  {$dest_path}";
    $rewrite_rules[] = sprintf(REWRITE_RULE, $source_path, $dest_path);
    if ($limit > -1 && $idx > $limit) {
        break;
    }
    $idx++;
}
// Dump the rules to stdout or ...?
//$bytes = file_put_contents( '.htaccess-copy', implode( "\n", $rewrite_rules ));
$bytes = write_php_file($rewrite_ar);
fprintf(STDERR, "PHP file written:  %s  (%d rewrite records)\n", PHP_OUT_FILE, count($rewrite_ar));
function write_php_file($rewrite_ar, $filename = PHP_OUT_FILE, $http_status = REDIRECT_STATUS)
{
    $default_url = get_base_url();
    $template = <<<EOT
<?php
/*
    Auto-generated!  Time:  __TIME__  (Via: rewritemap.php)
*/

\$http_status = '{$http_status}';
\$default_url = '{$default_url}';
\$map_count = __COUNT__;
\$map = __MAP__;