~ubuntu-branches/ubuntu/karmic/drupal6/karmic

« back to all changes in this revision

Viewing changes to modules/php/php.install

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2008-10-24 23:06:15 UTC
  • Revision ID: james.westby@ubuntu.com-20081024230615-a33t46nwna16bynv
Tags: upstream-6.6
ImportĀ upstreamĀ versionĀ 6.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
// $Id: php.install,v 1.1 2007/04/24 10:54:34 dries Exp $
 
3
 
 
4
/**
 
5
 * Implementation of hook_install().
 
6
 */
 
7
function php_install() {
 
8
  $format_exists = db_result(db_query("SELECT COUNT(*) FROM {filter_formats} WHERE name = 'PHP code'"));
 
9
  // Add a PHP code input format, if it does not exist. Do this only for the
 
10
  // first install (or if the format has been manually deleted) as there is no
 
11
  // reliable method to identify the format in an uninstall hook or in
 
12
  // subsequent clean installs.
 
13
  if (!$format_exists) {
 
14
    db_query("INSERT INTO {filter_formats} (name, roles, cache) VALUES ('PHP code', '', 0)");
 
15
    $format = db_result(db_query("SELECT MAX(format) FROM {filter_formats}"));
 
16
 
 
17
    // Enable the PHP evaluator filter.
 
18
    db_query("INSERT INTO {filters} (format, module, delta, weight) VALUES (%d, 'php', 0, 0)", $format);
 
19
 
 
20
    drupal_set_message(t('A !php-code input format has been created.', array('!php-code' => l('PHP code', 'admin/settings/filters/'. $format))));
 
21
  }
 
22
}
 
23
 
 
24
/**
 
25
 * Implementation of hook_disable().
 
26
 */
 
27
function php_disable() {
 
28
  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.'));
 
29
}