Beispiel #1
0
$path = readln("Website path:", "/var/www");
$virtualHostPath = readln("Path to virtual hosts: ", "/etc/apache2/sites-available");
$hostsFilePath = readln("Path to hosts file:", "/etc/hosts");
if (is_dir($path . "/" . $name)) {
    echo "\nDirectory: " . $path . "/" . $name . " already exists, skipping intial directory creation...\n";
} else {
    echo "\nCreating " . $path . "/" . $name . "...";
    mkdir($path . "/" . $name);
    echo "\nCopying default application into directory...";
    $source = '@php_dir@' == '@' . 'php_dir@' ? dirname(__FILE__) . '/../app' : '@php_dir@' . '/xframe/app';
    smartCopy($source, $path . "/" . $name);
    unlink($path . "/" . $name . "/.ignore");
    //update the conf files
    updateConf($path . "/" . $name . "/config/dev.ini", $path . "/" . $name);
    updateConf($path . "/" . $name . "/config/test.ini", $path . "/" . $name);
    updateConf($path . "/" . $name . "/config/live.ini", $path . "/" . $name);
}
if (file_exists($virtualHostPath . "/" . $name)) {
    echo "\nVirtual host configuration already exists, skipping...";
} else {
    echo "\nCreating virtual host configuration...";
    file_put_contents($virtualHostPath . "/" . $name, createVirtualHost($name, $path));
}
$hostsFile = file_get_contents($hostsFilePath);
$hostsEntry = "127.0.0.1       " . $name . " resource." . $name;
if (strpos($hostsFile, $hostsEntry) === false) {
    echo "\nAdding hosts entry...";
    $hostsFile .= "\n" . $hostsEntry;
    file_put_contents($hostsFilePath, $hostsFile);
} else {
    echo "\nHosts entry already exists, skipping...";
Beispiel #2
0
}
//Parse the config file into an array.
$_INICONF = parse_ini_file($full_ini_path);
//Stop now and let someone know if there is a problem.
if ($_INICONF === false) {
    die("Unable to parse config file at {$full_ini_path}. quitting.");
    die("Unable to parse config file. quitting.");
}
//Handle the firstrun
if (!empty($_INICONF['firstrun']) || !isset($_INICONF['webdocroot']) || isset($_INICONF['webdocroot']) && file_exists($_INICONF['webdocroot'] . '/updated')) {
    $_INICONF['hostname'] = `hostname`;
    $_INICONF['hostname'] = trim($_INICONF['hostname']);
    $_INICONF['inipath'] = $full_ini_path;
    $_INICONF['webdocroot'] = dirname(__FILE__);
    $_INICONF['firstrun'] = 0;
    updateConf($_INICONF);
    if (isset($_INICONF['webdocroot']) && file_exists($_INICONF['webdocroot'] . '/updated')) {
        unlink($_INICONF['webdocroot'] . '/updated');
    }
}
$_INICONF['version'] = file_get_contents($_INICONF['webdocroot'] . '/version');
//include and setup smarty right here. go ahead and
require_once $_INICONF['webdocroot'] . '/includes/smarty/Smarty.class.php';
$_VIEW = new Smarty();
$_VIEW->setTemplateDir($_INICONF['webdocroot'] . '/includes/tpl/themes/' . $_INICONF['webtheme'] . '/');
$_VIEW->setCompileDir($_INICONF['webdocroot'] . '/includes/smarty/templates_c/');
$_VIEW->setConfigDir($_INICONF['webdocroot'] . '/includes/smarty/configs/');
$_VIEW->setCacheDir($_INICONF['webdocroot'] . '/includes/smarty/cache/');
//$_VIEW->debugging = true; // show the debug console
//Pass the $_INICONF variable to smarty
$_VIEW->assign('_INICONF', $_INICONF);
Beispiel #3
0
function makeUpdate()
{
    $update_page_files = array();
    if (is_file(BASE_DIR . PLUGIN_DIR_NAME . '/Galerie/plugin.conf')) {
        updateConf(BASE_DIR . PLUGIN_DIR_NAME . '/Galerie/plugin.conf');
    }
    if (is_file(BASE_DIR . PLUGIN_DIR_NAME . '/Galerie/plugin.conf.php')) {
        global $gallery_plugin;
        $gallery_plugin = new Properties(BASE_DIR . PLUGIN_DIR_NAME . '/Galerie/plugin.conf.php');
    }
    if (is_dir(BASE_DIR . 'update')) {
        $cms_confs = array("basic", "main", "passwords", "gallery", "version", "logindata", "downloads", "catpage", "syntax", "user");
        $files = getDirAsArray(BASE_DIR . 'update', array(".conf"), "none");
        if (count($files) > 0) {
            global $GALLERY, $SYNTAX;
            $SYNTAX = new Properties(BASE_DIR_CMS . CONF_DIR_NAME . '/syntax.conf.php');
            $GALLERY = new Properties(BASE_DIR_CMS . CONF_DIR_NAME . '/gallery.conf.php');
            foreach ($files as $datei) {
                if (in_array(str_replace(".conf", "", $datei), $cms_confs)) {
                    updateCMSConf($datei);
                    mo_unlink(BASE_DIR . 'update/' . $datei);
                }
            }
        }
    }
    if (is_dir(BASE_DIR . 'galerien') and is_readable(BASE_DIR . 'galerien')) {
        foreach (getDirAsArray(BASE_DIR . GALLERIES_DIR_NAME, "dir", "none") as $datei) {
            $tmp_conf = false;
            if (is_file(BASE_DIR . GALLERIES_DIR_NAME . '/' . $datei . '/texte.conf')) {
                updateConf(BASE_DIR . GALLERIES_DIR_NAME . '/' . $datei . '/texte.conf');
            } else {
                newConf(BASE_DIR . GALLERIES_DIR_NAME . '/' . $datei . "/texte.conf.php");
            }
            if (is_file(BASE_DIR . GALLERIES_DIR_NAME . '/' . $datei . '/texte.conf.php')) {
                $tmp_conf = new Properties(BASE_DIR . GALLERIES_DIR_NAME . '/' . $datei . "/texte.conf.php");
            }
            $update_text = array();
            foreach (getDirAsArray(BASE_DIR . GALLERIES_DIR_NAME . '/' . $datei, "file", "none") as $img) {
                if ($img == 'texte.conf') {
                    continue;
                }
                if (false !== ($newname = isUpdateFileName($img, "file", true))) {
                    $status = updateRename($img, $newname, BASE_DIR . GALLERIES_DIR_NAME . "/" . $datei . "/");
                    if ($status) {
                        $newname = $status;
                    }
                    if ($tmp_conf !== false and $tmp_conf->keyExists($img)) {
                        $tmp_conf->set($newname, toUtf($tmp_conf->get($img)));
                        $tmp_conf->delete($img);
                    }
                    $update_page_files[$img] = $newname;
                    if (is_file(BASE_DIR . GALLERIES_DIR_NAME . "/" . $datei . "/" . PREVIEW_DIR_NAME . "/" . $img)) {
                        updateRename($img, $newname, BASE_DIR . GALLERIES_DIR_NAME . "/" . $datei . "/" . PREVIEW_DIR_NAME . "/");
                    }
                }
            }
            unset($tmp_conf);
            if (false !== ($newname = isUpdateFileName($datei, false, true))) {
                updateRename($datei, $newname, BASE_DIR . GALLERIES_DIR_NAME . "/");
            }
        }
    }
    if (is_dir(BASE_DIR . 'kategorien')) {
        $sort_array = array();
        $cats = getDirAsArray(BASE_DIR . CONTENT_DIR_NAME, "dir", "sort");
        $cats = sort_cat_page($cats, BASE_DIR . CONTENT_DIR_NAME, "dir");
        foreach ($cats as $cat) {
            #echo $cat."<br />\n";
            if (false !== ($newname = isUpdateFileName($cat, "catpage", true))) {
                updateRename($cat, $newname, BASE_DIR . CONTENT_DIR_NAME . "/");
                $cat = $newname;
            }
            $sort_array[$cat] = "null";
            if (substr($cat, -EXT_LENGTH) == EXT_LINK) {
                continue;
            }
            $sort_array[$cat] = array();
            $pages = getDirAsArray(BASE_DIR . CONTENT_DIR_NAME . '/' . $cat, "file", "sort");
            $pages = sort_cat_page($pages, BASE_DIR . CONTENT_DIR_NAME . '/' . $cat, "file");
            foreach ($pages as $page) {
                if (false !== ($newname = isUpdateFileName($page, "catpage", true))) {
                    updateRename($page, $newname, BASE_DIR . CONTENT_DIR_NAME . "/" . $cat . "/");
                    $page = $newname;
                }
                $sort_array[$cat][$page] = "null";
            }
            if (is_dir(BASE_DIR . CONTENT_DIR_NAME . '/' . $cat . '/' . CONTENT_FILES_DIR_NAME)) {
                foreach (getDirAsArray(BASE_DIR . CONTENT_DIR_NAME . '/' . $cat . '/' . CONTENT_FILES_DIR_NAME, "file", "none") as $file) {
                    if (false !== ($newname = isUpdateFileName($file, "file", true))) {
                        $status = updateRename($file, $newname, BASE_DIR . CONTENT_DIR_NAME . "/" . $cat . "/" . CONTENT_FILES_DIR_NAME . "/");
                        if ($status) {
                            $newname = $status;
                        }
                        $tmp_file = cleanUploadFile(changeMoziloOldSpecialChars($file, false));
                        $update_page_files[rawurldecode($cat)][$tmp_file] = $newname;
                    }
                }
            }
        }
        $sort_array = var_export($sort_array, true);
        file_put_contents(SORT_CAT_PAGE, "<?php if(!defined('IS_CMS')) die();\n\$cat_page_sort_array = " . $sort_array . ";\n?>", LOCK_EX);
        if (isset($_POST['update_pages']) and $_POST['update_pages'] == "true") {
            updatePages($update_page_files);
        }
    }
    if (is_dir(BASE_DIR . 'plugins')) {
        foreach (getDirAsArray(BASE_DIR . PLUGIN_DIR_NAME, "dir", "none") as $datei) {
            if (is_file(BASE_DIR . PLUGIN_DIR_NAME . '/' . $datei . '/plugin.conf')) {
                updateConf(BASE_DIR . PLUGIN_DIR_NAME . '/' . $datei . '/plugin.conf');
            }
            if ($datei == "CONTACT") {
                makeCONTACTSetings(BASE_DIR . PLUGIN_DIR_NAME . '/' . $datei . '/plugin.conf.php');
            }
        }
    }
    if (is_dir(BASE_DIR . 'layouts')) {
        foreach (getDirAsArray(BASE_DIR . LAYOUT_DIR_NAME, "dir", "none") as $datei) {
            if (is_file(BASE_DIR . LAYOUT_DIR_NAME . '/' . $datei . '/layoutsettings.conf') and is_file(BASE_DIR . LAYOUT_DIR_NAME . '/' . $datei . '/template.html')) {
                updateTemplate(BASE_DIR . LAYOUT_DIR_NAME . '/' . $datei . '/');
            }
            if (is_dir(BASE_DIR . LAYOUT_DIR_NAME . '/' . $datei . '/css')) {
                updateTemplateCSS(BASE_DIR . LAYOUT_DIR_NAME . '/' . $datei . '/');
            }
            if (false !== ($newname = isUpdateFileName($datei, false, true))) {
                updateRename($datei, $newname, BASE_DIR . LAYOUT_DIR_NAME . "/");
            }
        }
    }
}