Update of /cvsroot/upcase-project/UpCase/admin
In directory usw-pr-cvs1:/tmp/cvs-serv13497
Added Files:
installer.php
Log Message:
installer interface
--- NEW FILE: installer.php ---
<?php
include_once("../config/uc_config.inc");
// First lines to include
include_once("lib/uc_page.php");
// Start the session
$p = new UcPage("installer");
// Check permissions, log in if necessary
$p->open();
$sess = $p->getSession();
$user = $sess->getUser();
// other includes
include_once("lib/uc_utils.php");
include_once("lib/uc_repository.php");
include_once("lib/uc_installer.php");
$rep = new UcLocalRepository();
$inst = new UcInstaller();
// Check HTTP input vars
$catname = checkVarIn("cat", $rep->categories, false)
or die("Invalid category");
$category = $rep->getCategory($catname);
if (!$category)
die("Invalid category");
$pkgname = checkVarIn("pkg", $category->packages, false)
or die("Invalid package1");
$package = $category->getPackage($pkgname);
if (!$package)
die("Invalid package2");
if (checkVar("install", false))
$operation = "install";
else if (checkVar("upgrade", false))
{
$operation = "upgrade";
die("Not yet implemented");
}
else if (checkVar("cancel", false))
{
$operation = "cancel";
die("Not yet implemented");
}
else
$operation = "view";
// don't use the include_once directive unless you want
// to always display this page in the default language
include("config/uc_templates.inc");
if ($operation == "view")
{
$tmpl = new ModeliXe($uc_tmpl["INSTALLER"]);
$tmpl->SetModeliXe();
$tmpl->MxAttribut("installer", $ucConfig->wwwRoot . "/admin/installer.php");
$tmpl->MxText("pkgname", $package->name);
$tmpl->MxText("siteroot", $ucConfig->wwwModules . "/");
$tmpl->MxText("catname", $category->name);
$tmpl->MxWrite();
}
else if ($operation == "install")
{
$cfg = $GLOBALS["ucConfig"];
if (checkVar("pkgurl", false))
$pkgRelUrl = checkVar("pkgurl");
else
die("Please give a url that is under your site root");
if (checkVar("tblprefix", false))
$tblPrefix = checkVar("tblprefix");
else
die("You MUST specify a tables prefix");
$inst->saveMetaData($package);
// $pkgAbsolutePath = $cfg->modulesRoot . "/" . $pkgRelUrl;
$inst->install($package, $pkgRelUrl, $tblPrefix);
}
else if ($operation == "upgrade")
{
die("Not yet implemented upgrade feature");
}
// output
//$tmpl->MxWrite();
?>
|