--- C:/Users/zmove/Desktop/wordfilter/wordfilter.install Wed May 21 07:41:02 2008 +++ D:/Taf/Kalys/drupal6/sites/all/modules/wordfilter/wordfilter.install Tue Jun 03 14:20:03 2008 @@ -1,80 +1,95 @@ - t('The {wordfilter} table stores user ids of users and other users that they have chosen to ignore.'), - 'fields' => array( - 'id' => array( - 'description' => t('The ID of the wordfilter word pair.'), - 'type' => 'serial', - 'not null' => TRUE, - ), - 'words' => array( - 'description' => t('The word to filter.'), - 'type' => 'text', - 'not null' => TRUE, - ), - 'replacement' => array( - 'description' => t('The replacement word to filter with.'), - 'type' => 'varchar', - 'length' => 255, - 'not null' => TRUE, - 'default' => '', - ), - 'standalone' => array( - 'description' => t('A boolean to indicate if the word filtering should only be done if the word is not part of another word.'), - 'type' => 'int', - 'size' => 'tiny', - 'not null' => TRUE, - 'default' => 0, - ), - ), - 'primary key' => array('id'), - ); - - return $schema; -} -/** - * Implementation of hook_install(). - */ -function wordfilter_install() { - drupal_install_schema('wordfilter'); -} - -/** - * Implementation of hook_update(). - */ -function wordfilter_update_1() { - return _system_update_utf8(array('wordfilter')); -} - -function wordfilter_update_2() { - $ret = array(); - db_change_field($ret, 'wordfilter', 'words', 'words', array('type' => 'text', 'not null' => TRUE)); - return $ret; -} - -/** - * Update to lower module weight so that wordfiltering - * can occur before other modules can run hook_nodeapi - * and hook_comment - */ -function wordfilter_update_3() { - $ret = array(); - $ret[] = update_sql("UPDATE {system} SET weight = -1 WHERE name = '%s' AND type = '%s'", 'wordfilter', 'module'); - return $ret; -} - -/** - * Implementation of hook_uninstall(). - */ -function wordfilter_uninstall() { - drupal_uninstall_schema('wordfilter'); - variable_del('wordfilter_default_replacement'); - variable_del('wordfilter_node_title'); - variable_del('wordfilter_comment_title'); -} + t('The {wordfilter} table stores user ids of users and other users that they have chosen to ignore.'), + 'fields' => array( + 'id' => array( + 'description' => t('The ID of the wordfilter word pair.'), + 'type' => 'serial', + 'not null' => TRUE, + ), + 'language' => array( + 'description' => t('The language.'), + 'type' => 'text', + 'not null' => TRUE, + ), + 'words' => array( + 'description' => t('The word to filter.'), + 'type' => 'text', + 'not null' => TRUE, + ), + 'replacement' => array( + 'description' => t('The replacement word to filter with.'), + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'standalone' => array( + 'description' => t('A boolean to indicate if the word filtering should only be done if the word is not part of another word.'), + 'type' => 'int', + 'size' => 'tiny', + 'not null' => TRUE, + 'default' => 0, + ), + ), + 'primary key' => array('id'), + ); + + return $schema; +} +/** + * Implementation of hook_install(). + */ +function wordfilter_install() { + drupal_install_schema('wordfilter'); +} + +/** + * Implementation of hook_update(). + */ +function wordfilter_update_1() { + return _system_update_utf8(array('wordfilter')); +} + +function wordfilter_update_2() { + $ret = array(); + db_change_field($ret, 'wordfilter', 'words', 'words', array('type' => 'text', 'not null' => TRUE)); + return $ret; +} + +/** + * Update to lower module weight so that wordfiltering + * can occur before other modules can run hook_nodeapi + * and hook_comment + */ +function wordfilter_update_3() { + $ret = array(); + $ret[] = update_sql("UPDATE {system} SET weight = -1 WHERE name = '%s' AND type = '%s'", 'wordfilter', 'module'); + return $ret; +} + +/** + * Add language restriction to filters + */ +function wordfilter_update_4() { + $ret = array(); + $ret[] = update_sql("ALTER TABLE {wordfilter} ADD language VARCHAR( 12 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `id`"); + return $ret; +} + + +/** + * Implementation of hook_uninstall(). + */ +function wordfilter_uninstall() { + drupal_uninstall_schema('wordfilter'); + variable_del('wordfilter_default_replacement'); + variable_del('wordfilter_node_title'); + variable_del('wordfilter_comment_title'); +}