summaryrefslogtreecommitdiff
path: root/admin/admin_packages_inc.php
blob: e8056242a37bd178bdd6c3c766fae75b5d9a4f41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php

// $Header: /cvsroot/bitweaver/_bit_kernel/admin/admin_packages_inc.php,v 1.9 2006/10/11 07:45:46 spiderr Exp $

// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.

// Process Packages form
$fPackage = &$_REQUEST['fPackage'];   // emulate register_globals

# rescan to include all packages, installed and not installed
$gBitSystem->scanPackages(
	'bit_setup_inc.php', TRUE, 'all', TRUE, TRUE
);
ksort($gBitSystem->mPackages);	// So packages will be listed in alphabetical order

// make a copy of mPackages - expensive, but this is low use code

if(!empty( $_REQUEST['features'] ) ) {
	$pkgArray = $gBitSystem->mPackages;
	foreach( array_keys( $pkgArray ) as $pkgKey ) {
		$pkg = $pkgArray[$pkgKey];
		if( isset( $pkg['name'] ) ) {
			$pkgName = strtolower( $pkg['name'] );
			#can only change already installed packages that are not required
			if ($gBitSystem->isPackageInstalled($pkgName) && empty($pkg['required']) ) {
				if( isset( $_REQUEST['fPackage'][$pkgName] ) ) {
					#mark installed and active
					$gBitSystem->storeConfig( 'package_'.$pkgName, 'y', $pkgName );
					unset( $pkgArray[$pkgKey] );
				}
				else {
					#mark installed but not active
					$gBitSystem->storeConfig( 'package_'.$pkgName, 'i', $pkgName );
					unset( $pkgArray[$pkgKey] );
				}
			}
		}
	}
}

global $gBitInstaller;
$gBitInstaller = &$gBitSystem;
$gBitSystem->verifyInstalledPackages();
?>