예제 #1
0
    if (file_exists($oldconfig = dirname(dirname(dirname(__FILE__))) . '/' . ZENFOLDER . '/zp-config.php')) {
        //migrate old root configuration file.
        $zpconfig = file_get_contents($oldconfig);
        $i = strpos($zpconfig, '/** Do not edit above this line. **/');
        $zpconfig = "<?php\nglobal \$_zp_conf_vars;\n\$conf = array()\n" . substr($zpconfig, $i);
        file_put_contents(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE, $zpconfig);
        $result = @unlink(dirname(dirname(dirname(__FILE__))) . '/' . ZENFOLDER . '/zp-config.php');
        $newconfig = false;
        configMod();
    } else {
        if (file_exists($oldconfig = SERVERPATH . '/' . DATA_FOLDER . '/zenphoto.cfg')) {
            $zpconfig = "<?php\n" . file_get_contents($oldconfig) . "\n?>";
            file_put_contents(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE, $zpconfig);
            @unlink(SERVERPATH . '/' . DATA_FOLDER . '/zenphoto.cfg');
            $newconfig = false;
            configMod();
        } else {
            $newconfig = true;
            @copy(dirname(dirname(__FILE__)) . '/zenphoto_cfg.txt', SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE);
        }
    }
}
$zptime = filemtime($oldconfig = SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE);
@copy(dirname(dirname(__FILE__)) . '/dataaccess', $serverpath . '/' . DATA_FOLDER . '/.htaccess');
@chmod($serverpath . '/' . DATA_FOLDER . '/.htaccess', 0444);
if (session_id() == '') {
    session_start();
}
if (isset($_GET['mod_rewrite'])) {
    $mod = '&mod_rewrite=' . $_GET['mod_rewrite'];
} else {
예제 #2
0
function updateConfigfile($zp_cfg)
{
    global $xsrftoken;
    $mod1 = fileperms(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE) & 0777;
    $mod2 = fileperms(SERVERPATH . '/' . DATA_FOLDER) & 0777;
    @chmod(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE, 0777);
    if (is_writeable(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE)) {
        rename(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE, $backkup = SERVERPATH . '/' . DATA_FOLDER . '/' . str_replace(strrchr(CONFIGFILE, "."), '', CONFIGFILE) . '.bak.php');
        chmod($backkup, $mod1);
        if ($handle = fopen(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE, 'w')) {
            if (fwrite($handle, $zp_cfg)) {
                setupLog(gettext("Updated configuration file"));
                $base = true;
            }
        }
        fclose($handle);
        clearstatcache();
    }
    @chmod(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE, $mod2);
    $str = configMod();
    $xsrftoken = sha1(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE . $str . session_id());
}