| 1 |
<?PHP
|
| 2 |
// $Id: phpids.install,v 1.5.4.2.2.4 2008/04/19 14:36:54 swentel Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_requirements().
|
| 6 |
*/
|
| 7 |
function phpids_requirements($phase) {
|
| 8 |
$t = get_t();
|
| 9 |
|
| 10 |
if ($phase == 'install') {
|
| 11 |
$requirements['phpids'] = array(
|
| 12 |
'title' => $t('PHPIDS'),
|
| 13 |
'value' => $t('Found PHPIDS package'),
|
| 14 |
);
|
| 15 |
|
| 16 |
// Test current PHP version for PHPIDS install
|
| 17 |
if (version_compare('5.1.6', PHP_VERSION) != -1) {
|
| 18 |
$requirements['phpids']['value'] = $t('Unsupported PHP version found');
|
| 19 |
$requirements['phpids']['description'] = $t('To use PHPIDS your webhost must running with PHP 5.1.6 or higher. Your current PHP version: ' . PHP_VERSION);
|
| 20 |
$requirements['phpids']['severity'] = REQUIREMENT_ERROR;
|
| 21 |
}
|
| 22 |
} else if ($phase == 'runtime') {
|
| 23 |
$requirements['phpids'] = array(
|
| 24 |
'title' => $t('PHPIDS'),
|
| 25 |
'value' => $t('Found PHPIDS package'),
|
| 26 |
);
|
| 27 |
|
| 28 |
// Test PHPIDS package from http://www.php-ids.org install
|
| 29 |
if (!file_exists(variable_get('phpids_path',realpath(dirname(__FILE__))). '/IDS/Config/Config.ini')) {
|
| 30 |
$requirements['phpids']['value'] = $t('No PHPIDS package found');
|
| 31 |
$requirements['phpids']['description'] = $t('You must dowload the latest <a href="http://www.php-ids.org" target="_blank">PHPIDS package</a> and place in a php searchable path or the phpids module folder. Current PHPIDS path: '. variable_get('phpids_path',realpath(dirname(__FILE__))));
|
| 32 |
$requirements['phpids']['severity'] = REQUIREMENT_ERROR;
|
| 33 |
}
|
| 34 |
}
|
| 35 |
return $requirements;
|
| 36 |
}
|
| 37 |
|
| 38 |
/**
|
| 39 |
* Implementation of hook_install().
|
| 40 |
*/
|
| 41 |
function phpids_install() {
|
| 42 |
variable_set('phpids_path',realpath(dirname(__FILE__)));
|
| 43 |
variable_set('phpids_tmppath',ini_get('upload_tmp_dir'). 'phpids');
|
| 44 |
variable_set('phpids_maillevel',9);
|
| 45 |
variable_set('phpids_warnlevel',27);
|
| 46 |
variable_set('phpids_mail','');
|
| 47 |
variable_set('phpids_authenticated',2);
|
| 48 |
variable_set('phpids_anonymous',2);
|
| 49 |
}
|
| 50 |
|
| 51 |
/**
|
| 52 |
* Implementation of hook_uninstall().
|
| 53 |
*/
|
| 54 |
function phpids_uninstall() {
|
| 55 |
variable_del('phpids_path');
|
| 56 |
variable_del('phpids_tmppath');
|
| 57 |
variable_del('phpids_maillevel');
|
| 58 |
variable_del('phpids_warnlevel');
|
| 59 |
variable_del('phpids_mail');
|
| 60 |
variable_del('phpids_authenticated');
|
| 61 |
variable_del('phpids_anonymous');
|
| 62 |
}
|