<?php
/*
Copyright (C) 2001-2004 ZZOSS GbR, http://www.zzoss.com
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
@version $Id: packages.php,v 1.13 2004/04/05 06:49:42 ordnas Exp $
@copyright Copyright © 2001-2004 ZZ/OSS GbR, http://www.zzoss.com
@license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
*/
// execute init file
require_once 'inc/init.php';
$pkg_type = 'package';
if(isset($_REQUEST['type'])){
$pkg_type = $_REQUEST['type'];
}
// check if this script is part of installation procedure
if(/*isset($_REQUEST['mode']) && ($_REQUEST['mode'] == 'dev' || $_REQUEST['mode'] == 'instant') && */!$zi_registry->isProcedure($pkg_type.'s_manager')){
header('Location: packages_confirm.php'.zi_form_querystr());
exit;
} else {
$zi_registry->setProcedure($pkg_type.'s_deps', 'on');
}
/*
if(isset($_REQUEST['profile']) && $_REQUEST["profile"] != 'custom') {
header('Location: packages_auto.php'.zi_form_querystr());
exit;
}
*/
/***************************************************************************
* INSTALLER FRAMEWORK FUNCTIONS *
***************************************************************************/
function zi_process()
{
global $zi_registry;
$pkg_type = 'package';
if(isset($_REQUEST['type'])){
$pkg_type = $_REQUEST['type'];
}
$zi_registry->setPackageType($pkg_type);
$actions = array();
if(isset($_REQUEST["a"])){
$actions = $_REQUEST["a"];
}
// save the selection
$zi_registry->setPackagesActions($actions);
// clean up previous dependency queue
$zi_registry->unsetPackagesQueue();
}
/***************************************************************************
* STARTUP *
***************************************************************************/
// dirty redirect for online update
if(isset($_REQUEST["ZI_ONLINE_UPDATE"])) {
header("Location: online_update_distributors.php");
}
if(ZI_DEBUG){
ZZOSS_Debug::log('Script', $zi_registry->getApplicationPath(), __FILE__, __LINE__);
}
/***************************************************************************
* PAGE CONTENT *
***************************************************************************/
ob_start();
include 'themes/'.$GLOBALS['ZI']['theme'].'/header.php';
//print_r($_REQUEST);
$is_app = true;
// WORKAROUND: We explicitly need to set the application name from query string here,
// otherwise, always the first application in the applications array will be returned.
if(!$application = $zi_registry->getApplication($_REQUEST['application'])){
// The application data path does not exits.
// This is usually caused when the installer itself is developed without
// having it not yet installed properly, i.e. without plugins installed.
$is_app = false;
}
//$application = $zi_registry->getApplicationById($_REQUEST['id']);
//$zi_registry->setApplication($application['name'].' '.$application['release']['version']);
$pkg_type = 'package';
if(isset($_REQUEST['type'])){
$pkg_type = $_REQUEST['type'];
}
$zi_registry->setPackageType($pkg_type);
// TODO: this is a hack, because in prod mode, plugins_packages.reg is not updated properly
if($pkg_type == 'plugin'){
$zi_registry->unsetPackages();
}
?>
<h1>Application <?php echo ucfirst($pkg_type); ?>s</h1>
<h2><a href="info.php?mode=<?php echo $_REQUEST['mode']; ?>&type=application&distribution=<?php echo $_REQUEST['distribution']; ?>&application=<?php echo $_REQUEST['application']; ?>" onclick="javascript:window.open('info.php?mode=<?php echo $_REQUEST['mode']; ?>&type=application&distribution=<?php echo $_REQUEST['distribution']; ?>&application=<?php echo $_REQUEST['application']; ?>', 'ApplicationInformation', 'width=500,height=500,resizable=1,status=0,scrollbars=1,toolbar=0,location=0,directories=0,menubar=0,dependent=0');void(0);javascript:return(false);" target="_blank" title="<?php echo $application["summary"].' '.$application['release']['version']; ?>"><?php echo $application["summary"].' '.$application['release']['version']; ?></a></h2>
<h2><?php echo ucfirst($pkg_type); ?>s</h2>
<p>[<a href="package_add.php<?php echo zi_form_querystr(); ?>">Add <?php echo ucfirst($pkg_type); ?></a>]<?php
if($GLOBALS['ZI']['installer_dev'] || (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'dev')){
?>
[<a href="packages_reset.php<?php echo zi_form_querystr(); ?>&widget_type=popup" onclick="javascript:if(confirm('This will undo all previous installation work. Are you sure you want to continue?')){window.open('packages_reset.php<?php echo zi_form_querystr(); ?>&widget_type=popup', 'ApplicationInformation', 'width=500,height=500,resizable=1,status=0,scrollbars=1,toolbar=0,location=0,directories=0,menubar=0,dependent=0');}void(0);javascript:return(false);" target="_blank" title="<?php echo $application["summary"].' '.$application['release']['version']; ?>">Reset <?php echo ucfirst($pkg_type); ?>s</a>]
<?php
}
?>
</p>
<?php
if(!$is_app){
?>
<div class="warning">Application not registered.</div>
<?php
} else {
require_once 'ZZOSS_Portlet/Package.php';
$portlet_pkg = new ZZOSS_PortletPackage;
$portlet_pkg->setRegistry($zi_registry);
if(!$portlet_pkg->showList($pkg_type) && $pkg_type == 'plugin'){
// There are no plugins
if(isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'dev'){
// in dev mode, we show the message
ob_end_flush();
echo '<div class="warning">No '.$pkg_type.'s available.</div>';
} else {
ob_end_clean();
// in prod mode, we redirect
$_REQUEST['type'] = 'package';
header('Location: packages_reset.php'.zi_form_querystr());
exit;
}
} else {
ob_end_flush();
}
}
?>
<br clear="all"/>
<?php
if(isset($_REQUEST["profile"])) {
$zi_buttons['back'] = 'application_profile.php'.zi_form_querystr();
}
$link_next = "packages_confirm.php".zi_form_querystr();
$zi_buttons['next'] = $link_next;
include 'themes/'.$GLOBALS['ZI']['theme'].'/footer.php';
?>