Menu

[r1]: / index.php  Maximize  Restore  History

Download this file

79 lines (77 with data), 2.3 kB

 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
<?php
define('PHP_MINIMAL_VERSION', 5.0);
/**
*Check PHP version
*
* @author Olivier G <olbibigo@gmail.com>
* @version 1.0
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @link http://gemibloo.fr
*/
function fCheckVersion(){
if(FALSE === phpversion()){
return 'Cannot check installed PHP version';
}
if(floatval(phpversion() < PHP_MINIMAL_VERSION))
return 'You are using a version of PHP that is not at least the minimal required version ('.PHP_MINIMAL_VERSION.').';
else
return TRUE;
}//fCheckVersion
/**
*Check if all requested libraries are available
*
* @author Olivier G <olbibigo@gmail.com>
* @version 1.0
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @link http://gemibloo.fr
*/
function fCheckLibraries(){
$out = "";
if(FALSE === function_exists('imap_open'))
$out.= 'Imap';
if(FALSE === function_exists('mysql_connect'))
$out.= 'MySQL';
if(FALSE === function_exists('exif_read_data'))
$out.= 'Exif';
if(FALSE === function_exists('curl_init'))
$out.= 'Curl';
/*if(FALSE === function_exists('iterator_count'))
$out.= 'SPL';*/
if(empty($out))
return TRUE;
else
return 'One or several required PHP libraries are missing ('.$out.').';
}//fCheckLibraries
/**
*Set write access right to a few files and folders
*
* @author Olivier G <olbibigo@gmail.com>
* @version 1.0
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @link http://gemibloo.fr
*/
function fChangeFileRights(){
$files = array(
'_index.php',
'index.php',
'./data',
'./data/cache',
'./log'
);
//Loop through all files to set write right
foreach($files as $file){
if(FALSE === file_exists($file))
return 'Missing file ('.$file.')';
if(FALSE === chmod($file,0705))
return 'File rights cannot be changed ('.$file.')';
}
return TRUE;
}//fChangeFileRights
//Main code
if( (TRUE !== ($status = fCheckVersion()))
|| (TRUE !== ($status = fCheckLibraries()))
|| (TRUE !== ($status = fChangeFileRights()))){
echo $status.' As a consequence Gemibloo cannot be installed. Sorry :(';
}else
header('Location:install.php');
?>