diff options
author | Dries Buytaert <dries@buytaert.net> | 2007-04-24 10:54:35 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2007-04-24 10:54:35 +0000 |
commit | ffe4dc84d449e601561b7128212daf9758b6d9b0 (patch) | |
tree | bc2cbe4e0c6187772e8b4a51f790c0a750a571f9 /modules/php/php.install | |
parent | df1bea8bca2fad131b22428832f5334624968b02 (diff) | |
download | brdo-ffe4dc84d449e601561b7128212daf9758b6d9b0.tar.gz brdo-ffe4dc84d449e601561b7128212daf9758b6d9b0.tar.bz2 |
- Patch #46941 by Zen and Ber: move PHP input filter to dedicated module.
Diffstat (limited to 'modules/php/php.install')
-rw-r--r-- | modules/php/php.install | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/modules/php/php.install b/modules/php/php.install new file mode 100644 index 000000000..d5ee4d8bd --- /dev/null +++ b/modules/php/php.install @@ -0,0 +1,29 @@ +<?php +// $Id$ + +/** + * Implementation of hook_install(). + */ +function php_install() { + $format_exists = db_result(db_query("SELECT COUNT(*) FROM {filter_formats} WHERE name = 'PHP code'")); + // Add a PHP code input format, if it does not exist. Do this only for the + // first install (or if the format has been manually deleted) as there is no + // reliable method to identify the format in an uninstall hook or in + // subsequent clean installs. + if (!$format_exists) { + db_query("INSERT INTO {filter_formats} (name, roles, cache) VALUES ('PHP code', '', 0)"); + $format = db_result(db_query("SELECT MAX(format) FROM {filter_formats}")); + + // Enable the PHP evaluator filter. + db_query("INSERT INTO {filters} (format, module, delta, weight) VALUES (%d, 'php', 0, 0)", $format); + + drupal_set_message(t('A !php-code input format has been created.', array('!php-code' => l('PHP code', 'admin/settings/filters/'. $format)))); + } +} + +/** + * Implementation of hook_disable(). + */ +function php_disable() { + drupal_set_message(t('The PHP module has been disabled. Please note that any existing content that was using the PHP filter will now be visible in plain text. This might pose a security risk by exposing sensitive information, if any, used in the PHP code.')); +} |