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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
<?php
/**
* @version $Header: /cvsroot/bitweaver/_bit_install/install_checks.php,v 1.4 2005/07/17 17:36:04 squareing Exp $
* @package install
* @subpackage functions
*/
// 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.
// assign next step in installation process
$smarty->assign( 'next_step',$step + 1 );
$check_settings = check_settings();
$smarty->assign( "error",$error );
$smarty->assign( "warning",$warning );
$smarty->assign( "required",$check_settings['required'] );
$smarty->assign( "extensions",$check_settings['extensions'] );
$smarty->assign( "recommended",$check_settings['recommended'] );
$smarty->assign( "show",$check_settings['show'] );
if( !isset( $_SERVER['HTTP_REFERER'] ) ) {
$smarty->assign( "http_referer_error", TRUE );
$error = TRUE;
}
/**
* check_settings
*/
function check_settings() {
global $smarty,$error,$warning;
$config_file = clean_file_path( empty($_SERVER['CONFIG_INC']) ? (KERNEL_PKG_PATH.'config_inc.php') : $_SERVER['CONFIG_INC'] );
$i = 0;
// required settings - if not met, are passed into the array $reqd
// PHP system checks
$phpvers = '4.1.0';
if( phpversion() < $phpvers ) {
$required[$i]['note'] = '<strong>PHP version</strong> should be greater than <strong>'.$phpvers.'</strong>.<br />Your installed version of PHP is <strong>'.phpversion().'</strong>.';
$required[$i]['passed'] = FALSE;
} else {
$required[$i]['note'] = '<strong>PHP version</strong> is greater than <strong>'.$phpvers.'</strong>.<br />Your installed version of PHP is <strong>'.phpversion().'</strong>.';
$required[$i]['passed'] = TRUE;
}
// check file and directory permissisions
$i++;
if( @file_exists( $config_file ) && @is_writable( $config_file ) ) {
$required[$i]['note'] = 'The configuration file \'<strong>config_inc.php</strong>\' is available and the file is writeable.';
$required[$i]['passed'] = TRUE;
} elseif( @file_exists( $config_file ) && !@is_writable( $config_file ) ) {
$required[$i]['note'] = 'The configuration file \'<strong>config_inc.php</strong>\' is available but the file is not writeable. Please execute something like:<br />chmod 777 '.$config_file;
$required[$i]['passed'] = FALSE;
} else {
$required[$i]['note'] = 'The configuration file \'<strong>config_inc.php</strong>\' is not available. Please execute something like:<br />touch '.KERNEL_PKG_PATH.'config_inc.php; chmod 777 '.$config_file;
$required[$i]['passed'] = FALSE;
}
$i++;
$dir_check = array( 'storage','temp' );
foreach( $dir_check as $d ) {
// final attempt to create the required directories
@mkdir( BIT_ROOT_PATH.$d,0644 );
if( @is_dir( BIT_ROOT_PATH.$d ) && is_writeable( BIT_ROOT_PATH.$d ) ) {
$required[$i]['note'] = 'The directory \'<strong>'.$d.'</strong>\' is available and it is writeable.';
$required[$i]['passed'] = TRUE;
} elseif( @is_dir( BIT_ROOT_PATH.$d ) && !is_writeable( BIT_ROOT_PATH.$d ) ) {
$required[$i]['note'] = 'The directory \'<strong>'.$d.'</strong>\' is available but it is not writeable.<br />Please execute something like:<br />chmod -R 777 '.BIT_ROOT_PATH.$d;
$required[$i]['passed'] = FALSE;
} else {
$required[$i]['note'] = 'The directory \'<strong>'.$d.'</strong>\' is not available and we cannot create it automaticalliy.<br />Please execute something like:<br />mkdir -m 777 '.BIT_ROOT_PATH.$d;
$required[$i]['passed'] = FALSE;
}
$i++;
}
foreach( $required as $r ) {
if( !$r['passed'] ) {
$error = TRUE;
}
}
$i = 0;
// check extensions
$php_ext = array(
'zlib' => 'The zlib compression libraries are used to pack and unpack compressed files such as zip files.',
'gd' => 'GD Libraries are used to manipulate images. We use these libraries to create thumbnails and convert images from one format to another. The GD libaries are quite limited and <strong>don\'t support</strong> a number of image formats including <strong>bmp</strong>. If you are planning on uploading and using a lot of images, we recommend you use ImageMagic instead.<br />If you are running Red Hat or Fedora Core, you can try running: yum install php-gd.',
'imagick' => 'ImageMagick supports a multitude of different image and video formats and <strong>can be used instead of the GD Libraries</strong>. Using these libraries will allow you to upload most image formats without any difficulties. It also requires less memory than the GD Libraries.<br />To find out more about <a class="external" href="http://www.imagemagick.org">ImageMagick</a>, please visit their homepage.
<dl>
<dt>*nix</dt>
<dd>Prebuilt RPMs are available for Fedora and RedHat from <a class="external" href="http://phprpms.sourceforge.net/imagick">phpRPMs</a> or compile a <a class="external" href="http://sourceforge.net/project/showfiles.php?group_id=112092&package_id=139307&release_id=292417">source RPM</a>.</dd>
<dt>Windows</dt>
<dd>For information on how to install ImageMagick on Windows, please visit <a class="external" href="http://www.bitweaver.org/wiki/ImagemagickOnWindows">Install ImageMagick on Windows</a>.</dd>
</dl>',
);
foreach( $php_ext as $ext => $note ) {
$extensions[$i]['note'] = 'The extension <strong>'.$ext.'</strong> is ';
if( extension_loaded( $ext ) ) {
$extensions[$i]['passed'] = TRUE;
} else {
$extensions[$i]['note'] .= 'not ';
$extensions[$i]['passed'] = FALSE;
}
$extensions[$i]['note'] .= 'available.<br />'.$note;
$i++;
}
foreach( $extensions as $e ) {
if( !$e['passed'] ) {
$warning = TRUE;
}
}
$i = 0;
// recommended php toggles - these don't need explicit explanations on how to rectify them
// start with special cases
$recommended[$i] = array( 'Memory Limit','memory_limit','shouldbe' => 'at least 8M','actual' => get_cfg_var( 'memory_limit' ) );
if( eregi_replace( 'M','',get_cfg_var( 'memory_limit' ) ) > 8 ) {
$recommended[$i]['passed'] = TRUE;
} else {
$recommended[$i]['passed'] = FALSE;
$smarty->assign( 'memory_warning', TRUE );
}
$i++;
// now continue with easy toggle checks
$php_rec_toggles = array(
array( 'Safe Mode','safe_mode','shouldbe' => 'OFF', ),
array( 'Display Errors','display_errors','shouldbe' => 'ON' ),
array( 'File Uploads','file_uploads','shouldbe' => 'ON' ),
array( 'Magic Quotes GPC','magic_quotes_gpc','shouldbe' => 'ON' ),
array( 'Magic Quotes Runtime','magic_quotes_runtime','shouldbe' => 'OFF' ),
array( 'Magic Quotes Sybase','magic_quotes_sybase','shouldbe' => 'OFF' ),
array( 'Register Globals','register_globals','shouldbe' => 'OFF' ),
array( 'Output Buffering','output_buffering','shouldbe' => 'OFF' ),
array( 'Session auto start','session.auto_start','shouldbe' => 'OFF' ),
);
foreach ($php_rec_toggles as $php_rec_toggle) {
$php_rec_toggle['actual'] = get_php_setting( $php_rec_toggle[1] );
if ( get_php_setting( $php_rec_toggle[1] ) == $php_rec_toggle['shouldbe'] ) {
$php_rec_toggle['passed'] = TRUE;
} else {
$php_rec_toggle['passed'] = FALSE;
}
$recommended[] = $php_rec_toggle;
$i++;
}
// settings that are useful to know about
$php_ini_gets = array(
array( '<strong>Maximum post size</strong> will restrict the size of files when you upload a file using a form.','post_max_size' ),
array( '<strong>Upload max filesize</strong> is related to maximim post size and will also limit the size of uploads.','upload_max_filesize' ),
array( '<strong>Maximum execution time</strong> is related to time outs in PHP - affects database upgrades and backups.','max_execution_time' ),
);
foreach( $php_ini_gets as $php_ini_get ) {
$show[] = $php_ini_get[0].'<br />This value is set to <strong>'.ini_get( $php_ini_get[1] ).'</strong>';
}
$res['required'] = $required;
$res['extensions'] = $extensions;
$res['recommended'] = $recommended;
$res['show'] = $show;
return $res;
}
/**
* get_php_setting
*/
function get_php_setting( $val ) {
$r = ( ini_get( $val ) == '1' ? 1 : 0 );
return $r ? 'ON' : 'OFF';
}
?>
|