Location: PHPKode > projects > ZZ/OSS Installer > zic-1.1.0dev1/installer/setup.php
<?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: setup.php,v 1.15 2004/04/06 19:51:09 ordnas Exp $
    @copyright Copyright &copy; 2001-2004 ZZ/OSS GbR, http://www.zzoss.com
    @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
    */
    
    // check if data directory has been provided
    require_once 'inc/config_params.php';
    require_once 'lib/ZZOSS_File/File.php';
	
    if(!isset($GLOBALS['ZI']['data']) || !strlen($GLOBALS['ZI']['data'])){
        echo "<p>You need to set the absolute path to the directory where the installer stores all its data.</p>";
        echo "<p>Do this in <code>\$GLOBALS['ZI']['data']</code> of the file '<code>".getcwd().DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config_params.php</code>'.";
        echo "<p>For example:</p>";
        echo "<pre>\$GLOBALS['ZI']['data'] = '".addslashes(ZZOSS_File::fixPath(dirname($_SERVER['DOCUMENT_ROOT']).DIRECTORY_SEPARATOR."zic_data".DIRECTORY_SEPARATOR))."';</pre>";
        exit;
    } elseif(!is_writeable($GLOBALS['ZI']['data'].DIRECTORY_SEPARATOR.'.')){
        echo "<p>Please make sure that the data directory '<code>".ZZOSS_File::fixPath($GLOBALS['ZI']['data'])."</code>' exists and is writeable.";
        echo "<p>Or change the path in <code>\$GLOBALS['ZI']['data']</code> of the file <code>".getcwd().DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config_params.php</code>.";
        exit;
    }
    
    // initialize framework
    require_once 'inc/init.php';
    
    // Check if this is a fresh setup installation
    // of the installer. If so, then we take over the
    // data of the installer which installed us.
    // This way, the installed installer is registered
    // within itself and can be updated.
    $installs = ZZOSS_InstallerUtils::unserializeFromFile($zi_setup->getDataDir().'.installed_by.reg');
    if(isset($installs[getcwd().DIRECTORY_SEPARATOR])){
        $installed_by = $installs[getcwd().DIRECTORY_SEPARATOR];
        
        // Modify the .init file.
        $inits = ZZOSS_InstallerUtils::unserializeFromFile($zi_setup->getInitFile());
        $data_dir = $inits[$installed_by];
        $inits[getcwd()] = $data_dir;
        ZZOSS_InstallerUtils::serializeToFile($zi_setup->getInitFile(), $inits);
        /*
        // grab all plugins from the setup installer and copy them
        // to our plugins directory
        require_once 'ZZOSS_Installer/Utils.php';
        ZZOSS_InstallerUtils::copy($installed_by.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR, 'plugins'.DIRECTORY_SEPARATOR);
        */
        // Delete the .htpasswd so that we have a fresh login.
        if(file_exists($data_dir.'.htpasswd')){
            unlink($data_dir.'.htpasswd');
        }
        /*
        header('Location: index.php');
        exit;*/
    } elseif(!$zi_setup->init()){
        $msg = $zi_setup->getError();
    } elseif(!$zi_setup->initData()){
        $msg = $zi_setup->getError();
    }
    
    if(!isset($msg)){
        require_once 'ZZOSS_File/File.php';
        // copy the installer files for the instant bundle to data directory
        $instant_dir = ZZOSS_File::fixPath($zi_setup->getInstallerDataDir().DIRECTORY_SEPARATOR.'instant'.DIRECTORY_SEPARATOR);
        //System::mkdir(array('-p', $instant_dir));
        require_once 'ZZOSS_Dir/Dir.php';
        ZZOSS_Dir::copy(getcwd(), $instant_dir);
        
        if(is_dir($instant_dir.'bundles'.DIRECTORY_SEPARATOR)){
            // remove the bundles directory from the instant sources
            System::rm(array('-rf', $instant_dir.'bundles'.DIRECTORY_SEPARATOR));
        }
        
        // Extract the bundled installer.
        require_once 'ZZOSS_Package/Package.php';
        ZZOSS_Package::extractBundles(getcwd().DIRECTORY_SEPARATOR.'bundles'.DIRECTORY_SEPARATOR, $zi_setup->getInstallerDataDir());
    }
    
    require_once 'themes/'.$GLOBALS['ZI']['theme'].'/header.php';
?>
<h1>ZZ/OSS Installer Client (ZIC)</h1>
<h1>Version <?php echo $GLOBALS['ZI']['version']; ?></h1>
<p align="center">Professional installation wizard for modular PHP applications.</p>
<p align="center"><a href="http://www.zzoss.com/projects/installer" target="_blank">http://www.zzoss.com/projects/installer</a></p>
<?php
if(!isset($msg)){
    $msg = 'Installer has been initiated. Data directory is \''.$GLOBALS['ZI']['data'].'\'';
}
    ?><div class="warning"><?php echo $msg; ?></div><?php
    
    /*
    // check if the installer directory is writeable.
    $is_writeable = true;
    if(!is_writeable('.')){
        $is_writeable = false;
        ?>
        <h2>Write Access</h2>
        <div class="warning">The installer needs write access to its directories in<br/>
        <?php echo getcwd().DIRECTORY_SEPARATOR; ?></div>
        <?php
    }
    */
  if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'){
?>
<h2>Encryption on</h2>
<p>You are using SSL encryption (HTTPS), which ensures that data sent from your browser to the installer cannot be read by others.</p>
<?php
  } else {
  ?>
<h2>Security</h2>

<p>On a public server, your are strongly advised to use SSL encryption (HTTPS), because you might provide critical data during the installation process (e.g. database connection parameters). This is your secure SSL link if you have SSL installed on your server: <a href="https://<?php echo $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; ?>">https://<?php echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?></a></p>

<p>
<?php
  }
  ?>
<p>In general, two icons in the top left corner constantly let you know if encryption is <img src="<?php echo $chdir; ?>themes/share/icons/org.kde.icons.crystalsvg/16x16/encrypted.gif" border="0" alt="Encrypted" title="Encrypted"/> available or <img src="<?php echo $chdir; ?>themes/share/icons/org.kde.icons.crystalsvg/16x16/decrypted.gif" border="0" alt="Decrypted" title="Decrypted"/> not.</p>

<h2>JavaScript</h2>
<p>Please turn JavaScript on in your browser for better usability.</p>

<h2>Warranty</h2>
<p>You have obtained ZZ/OSS Installer under the terms of the LGPL open source license displayed below. The license states that this software comes without any warranty. If you want to be able to claim warranty, ZZ/OSS sells commercial licenses stating liability by ZZ/OSS for the installer.</p>

<h2>Usage</h2>
<p>You are allowed to use this software under the terms of the LGPL license displayed below. If in doubt, you can obtain a commercial license from ZZ/OSS that allows to use the product in situations where an open source license is not appropriate.</p>
<p>ZZ/OSS asks you to keep the <a href="about.php" onclick="javascript:window.open('about.php', 'About', 'width=400,height=400,resizable=1,status=0,scrollbars=1,toolbar=0,location=0,directories=0,menubar=0,dependent=0');void(0);javascript:return(false);" target="_blank" title="About"><!--<img src="<?php echo $chdir; ?>themes/share/icons/org.kde.icons.crystalsvg/16x16/info.gif" alt="About Installer" title="About Installer">-->About</a> page as is to honour those who contributed to this product. If you would like to modify or remove it, please obtain a commercial license from ZZ/OSS.</p>
<p>You might send us a note to <a href="mailto:hide@address.com">hide@address.com</a> and let us know that you are using our product. Thank you!</p>

<h2>Open Source License</h2>
<textarea cols="60" rows="20"><?php readfile('LICENSE'); ?></textarea>

<h2>Commercial License</h2>
<p>For more information on the commercial license, please contact <a href="mailto:hide@address.com">hide@address.com</a>.</p>

<p align="center"><a href="http://www.zzoss.com" target="_blank"><img src="themes/share/logos/com.zzoss.logos/zzoss_powered_by.gif" border="0"></a></p>
<p align="center">
    <a href="http://www.php.net" target="_blank"><img alt="Powered by PHP" src="themes/share/logos/net.php.logos/php-power-white.gif" border="0"></a>
    <a href="http://pear.php.net" target="_blank"><img alt="Powered by PEAR" src="themes/share/logos/net.php.pear.logos/pear-power.gif" border="0"></a>
</p>
  <?php

    $zi_buttons['next'] = 'index.php';

    require_once 'themes/'.$GLOBALS['ZI']['theme'].'/footer.php';
?>
Return current item: ZZ/OSS Installer