| 2 |
// $Id$ |
// $Id$ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
|
* @file |
| 6 |
|
* Installs the abuse module |
| 7 |
|
*/ |
| 8 |
|
|
| 9 |
|
/** |
| 10 |
* Implementation of hook_install(). |
* Implementation of hook_install(). |
| 11 |
*/ |
*/ |
| 12 |
function abuse_install() { |
function abuse_install() { |
| 97 |
'unsigned' => TRUE, |
'unsigned' => TRUE, |
| 98 |
'not null' => TRUE, |
'not null' => TRUE, |
| 99 |
), |
), |
|
|
|
| 100 |
), |
), |
| 101 |
'primary key' => array('aid'), |
'primary key' => array('aid'), |
| 102 |
'indexes' => array('oid_type' => array('oid', 'type'), 'uid' => array('uid')), |
'indexes' => array('oid_type' => array('oid', 'type'), 'uid' => array('uid')), |
| 103 |
); |
); |
| 104 |
|
|
| 105 |
$schema['abuse_warnings'] = array( |
$schema['abuse_warnings'] = array( |
| 106 |
'description' => t('A list of warnings that have been sent out to users for inappropriate content'), |
'description' => t('A list of warnings that have been sent out to users for inappropriate content'), |
| 107 |
'fields' => array( |
'fields' => array( |
| 140 |
), |
), |
| 141 |
), |
), |
| 142 |
'indexes' => array( |
'indexes' => array( |
| 143 |
'oid_type_created' => array('oid', 'type', 'created'), |
'oid_type_created' => array('oid', 'type', 'created'), |
| 144 |
'uid' => array('uid'), |
'uid' => array('uid'), |
| 145 |
'sent_by_uid' => array('sent_by_uid') |
'sent_by_uid' => array('sent_by_uid') |
| 146 |
), |
), |
| 147 |
); |
); |
| 183 |
'not null' => TRUE, |
'not null' => TRUE, |
| 184 |
'default' => 0, |
'default' => 0, |
| 185 |
), |
), |
|
|
|
| 186 |
), |
), |
| 187 |
'primary key' => array('oid', 'type'), |
'primary key' => array('oid', 'type'), |
| 188 |
'indexes' => array( |
'indexes' => array( |
| 228 |
'unsigned' => TRUE, |
'unsigned' => TRUE, |
| 229 |
'not null' => TRUE, |
'not null' => TRUE, |
| 230 |
), |
), |
|
|
|
| 231 |
), |
), |
| 232 |
'indexes' => array( |
'indexes' => array( |
| 233 |
'uid' => array('uid'), |
'uid' => array('uid'), |
| 267 |
), |
), |
| 268 |
'primary key' => array('arid'), |
'primary key' => array('arid'), |
| 269 |
); |
); |
| 270 |
|
|
| 271 |
return $schema; |
return $schema; |
| 272 |
} |
} |
| 273 |
|
|
| 274 |
function abuse_install_default_reasons() { |
function abuse_install_default_reasons() { |
| 275 |
$sql_template = "INSERT INTO {abuse_reasons} (reason, description, argumentation) VALUES ('%s', '%s', '%s')"; |
$sql_template = "INSERT INTO {abuse_reasons} (reason, description, argumentation) VALUES ('%s', '%s', '%s')"; |
| 276 |
|
|
| 277 |
$result1 = db_query($sql_template, "foul language", t('The user wrote very mean things'), t('Please refrain from writing such mean things')); |
$result1 = db_query($sql_template, "foul language", t('The user wrote very mean things'), t('Please refrain from writing such mean things')); |
| 278 |
$result2 = db_query($sql_template, "adult themes", t('The user\'s wrote very explicit language'), t('Please refrain from writing such mean things')); |
$result2 = db_query($sql_template, "adult themes", t('The user\'s wrote very explicit language'), t('Please refrain from writing such mean things')); |
| 279 |
$result3 = db_query($sql_template, "racist or sexist language", t('The user wrote very derogatory comments'), t('Please refrain from writing such mean things')); |
$result3 = db_query($sql_template, "racist or sexist language", t('The user wrote very derogatory comments'), t('Please refrain from writing such mean things')); |
| 282 |
|
|
| 283 |
if ($result1 && $result2 && $result3 && $result4 && $result5) { |
if ($result1 && $result2 && $result3 && $result4 && $result5) { |
| 284 |
drupal_set_message('Abuse reason table installation was a success'); |
drupal_set_message('Abuse reason table installation was a success'); |
| 285 |
} |
} |
| 286 |
else { |
else { |
| 287 |
drupal_set_message('Retry from the start (remove abuse sequence and abuse reasons table)'); |
drupal_set_message('Retry from the start (remove abuse sequence and abuse reasons table)'); |
| 288 |
} |
} |