assign( 'next_step',$step + 1 );
$check_settings = check_settings();
$gBitSmarty->assign( "error",$error );
$gBitSmarty->assign( "warning",$warning );
$gBitSmarty->assign( "required",$check_settings['required'] );
$gBitSmarty->assign( "extensions",$check_settings['extensions'] );
$gBitSmarty->assign( "recommended",$check_settings['recommended'] );
$gBitSmarty->assign( "show",$check_settings['show'] );
if( !isset( $_SERVER['HTTP_REFERER'] ) ) {
$gBitSmarty->assign( "http_referer_error", TRUE );
$error = TRUE;
}
/**
* check_settings
*/
function check_settings() {
global $gBitSmarty,$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'] = 'PHP version should be greater than '.$phpvers.'.
Your installed version of PHP is '.phpversion().'.';
$required[$i]['passed'] = FALSE;
} else {
$required[$i]['note'] = 'PHP version is greater than '.$phpvers.'.
Your installed version of PHP is '.phpversion().'.';
$required[$i]['passed'] = TRUE;
}
// check file and directory permissisions
$i++;
if( @file_exists( $config_file ) && @bw_is_writeable( $config_file ) ) {
$required[$i]['note'] = 'The configuration file \''.$config_file.'\' is available and the file is writeable.';
$required[$i]['passed'] = TRUE;
} elseif( @file_exists( $config_file ) && !@bw_is_writeable( $config_file ) ) {
$required[$i]['note'] = 'The configuration file \''.$config_file.'\' is available but the file is not writeable. Please execute something like:
chmod 777 '.$config_file;
$required[$i]['passed'] = FALSE;
} else {
$required[$i]['note'] = 'The configuration file \''.$config_file.'\' is not available. Please execute something like:
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 ) && bw_is_writeable( BIT_ROOT_PATH.$d ) ) {
$required[$i]['note'] = 'The directory \''.BIT_ROOT_PATH.$d.'\' is available and it is writeable.';
$required[$i]['passed'] = TRUE;
} elseif( @is_dir( BIT_ROOT_PATH.$d ) && !bw_is_writeable( BIT_ROOT_PATH.$d ) ) {
$required[$i]['note'] = 'The directory \''.BIT_ROOT_PATH.$d.'\' is available but it is not writeable.
Please execute something like:
chmod -R 777 '.BIT_ROOT_PATH.$d;
$required[$i]['passed'] = FALSE;
} else {
$required[$i]['note'] = 'The directory \''.BIT_ROOT_PATH.$d.'\' is not available and we cannot create it automaticalliy.
Please execute something like:
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 don\'t support a number of image formats including bmp. If you are planning on uploading and using a lot of images, we recommend you use ImageMagic instead.
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 can be used instead of the GD Libraries. Using these libraries will allow you to upload most image formats without any difficulties. It also requires less memory than the GD Libraries.
To find out more about ImageMagick, please visit their homepage.