| 3 |
|
|
| 4 |
define('CONFIGURE_WATCHLIST_SETTINGS', 'configure watchlist settings'); |
define('CONFIGURE_WATCHLIST_SETTINGS', 'configure watchlist settings'); |
| 5 |
define('WATCHLIST_PREMODERATE_CONTENT_TYPE', 'watchlist_premoderate_content_type_'); |
define('WATCHLIST_PREMODERATE_CONTENT_TYPE', 'watchlist_premoderate_content_type_'); |
| 6 |
define('WATCHLIST_MODERATE_CONTENT_TYPE', 'watchlist_moderate_content_type'); |
define('WATCHLIST_MODERATE_CONTENT_TYPE', 'watchlist_moderate_content_type_'); |
| 7 |
|
|
| 8 |
function watchlist_perm() { |
function watchlist_perm() { |
| 9 |
return array(CONFIGURE_WATCHLIST_SETTINGS); |
return array(CONFIGURE_WATCHLIST_SETTINGS); |
| 22 |
'description' => 'Test the regular expressions set in the watchlist by testing words and sentences', |
'description' => 'Test the regular expressions set in the watchlist by testing words and sentences', |
| 23 |
'page callback' => 'watchlist_js_test_settings_form', |
'page callback' => 'watchlist_js_test_settings_form', |
| 24 |
'access arguments' => array(CONFIGURE_WATCHLIST_SETTINGS), |
'access arguments' => array(CONFIGURE_WATCHLIST_SETTINGS), |
| 25 |
|
'type' => MENU_CALLBACK, |
| 26 |
); |
); |
| 27 |
return $items; |
return $items; |
| 28 |
} |
} |
| 36 |
case 'prepare': |
case 'prepare': |
| 37 |
return $text; |
return $text; |
| 38 |
case 'process': |
case 'process': |
| 39 |
$words = explode("\n", variable_get("watchlist_banned_words", '')); |
$words = variable_get("watchlist_banned_words", ''); |
| 40 |
|
$badwords = _watchlist_generate_list($words); |
| 41 |
$replacement = variable_get("watchlist_banned_words_replacement", ''); |
$replacement = variable_get("watchlist_banned_words_replacement", ''); |
|
for ($i = 0; $i < count($words); $i++) { |
|
|
$words[$i] = '/'.trim($words[$i]).'/i'; |
|
|
$replacements[$i] = $replacement; |
|
|
} |
|
| 42 |
|
|
| 43 |
$output = $text; |
$output = $text; |
| 44 |
$output = _watchlist_filter_phone($output); |
$output = _watchlist_filter_phone($output); |
| 45 |
$output = _watchlist_filter_email($output); |
$output = _watchlist_filter_email($output); |
| 46 |
|
if (sizeof($words) > 0) { |
| 47 |
$output = preg_replace($words, $replacements, $output); |
$output = preg_replace($badwords, $replacement, $output); |
| 48 |
|
} |
| 49 |
return $output; |
return $output; |
| 50 |
default: |
default: |
| 51 |
return $text; |
return $text; |
| 74 |
|
|
| 75 |
function watchlist_admin_settings_form(&$form_state) { |
function watchlist_admin_settings_form(&$form_state) { |
| 76 |
$form = array(); |
$form = array(); |
| 77 |
$form['watchlist_words'] = array( |
$form['watchlist_watch'] = array( |
| 78 |
|
'#type' => 'fieldset', |
| 79 |
|
'#title' => t('Watchlist word settings'), |
| 80 |
|
'#description' => t('These words fall in a grey area of being good or bad. Content found with these words will be flagged into the pending pile (and into a hidden pile if premoderation is allowed on the content type)'), |
| 81 |
|
'#collapsible' => TRUE, |
| 82 |
|
'#collapsed' => FALSE, |
| 83 |
|
); |
| 84 |
|
$form['watchlist_watch']['watchlist_words'] = array( |
| 85 |
'#type' => 'textarea', |
'#type' => 'textarea', |
| 86 |
'#title' => t('Watch list'), |
'#title' => t('Watch list'), |
| 87 |
'#cols' => 40, |
'#cols' => 70, |
| 88 |
'#rows' => 10, |
'#rows' => 10, |
| 89 |
'#default_value' => variable_get("watchlist_words", ''), |
'#default_value' => trim(variable_get("watchlist_words", '')), |
| 90 |
'#description' => t('The watch list, one per line') |
'#description' => t('The watch list, one per line. Do not use empty line breaks.') |
| 91 |
); |
); |
| 92 |
$form['watchlist_banned'] = array( |
$form['watchlist_banned'] = array( |
| 93 |
'#title' => t('Filtered/banned word settings'), |
'#title' => t('Filtered/banned word settings'), |
| 99 |
$form['watchlist_banned']['watchlist_banned_words'] = array( |
$form['watchlist_banned']['watchlist_banned_words'] = array( |
| 100 |
'#type' => 'textarea', |
'#type' => 'textarea', |
| 101 |
'#title' => t('Filtered/banned word list'), |
'#title' => t('Filtered/banned word list'), |
| 102 |
'#cols' => 40, |
'#cols' => 70, |
| 103 |
'#rows' => 10, |
'#rows' => 10, |
| 104 |
'#default_value' => variable_get("watchlist_banned_words", ''), |
'#default_value' => trim(variable_get("watchlist_banned_words", '')), |
| 105 |
'#description' => t('The banned word list, one per line') |
'#description' => t('The banned word list, one per line. Do not use empty line breaks.') |
| 106 |
); |
); |
| 107 |
$form['watchlist_banned']["watchlist_banned_words_replacement"] = array( |
$form['watchlist_banned']["watchlist_banned_words_replacement"] = array( |
| 108 |
'#title' => t('Replacement string'), |
'#title' => t('Replacement string'), |
| 132 |
'#default_value' => variable_get(WATCHLIST_MODERATE_CONTENT_TYPE . $type, 0), |
'#default_value' => variable_get(WATCHLIST_MODERATE_CONTENT_TYPE . $type, 0), |
| 133 |
); |
); |
| 134 |
} |
} |
| 135 |
$form['moderated'][WATCHLIST_MODERATE_CONTENT_TYPE.'comments'] = array( |
$form['moderated'][WATCHLIST_MODERATE_CONTENT_TYPE .'comment'] = array( |
| 136 |
'#title' => t('comments'), |
'#title' => t('comment'), |
| 137 |
'#type' => 'checkbox', |
'#type' => 'checkbox', |
| 138 |
'#return_value' => 1, |
'#return_value' => 1, |
| 139 |
'#default_value' => variable_get(WATCHLIST_MODERATE_CONTENT_TYPE.'comments', 0), |
'#default_value' => variable_get(WATCHLIST_MODERATE_CONTENT_TYPE .'comment', 0), |
| 140 |
); |
); |
| 141 |
$form['moderated'][WATCHLIST_MODERATE_CONTENT_TYPE.'users'] = array( |
$form['moderated'][WATCHLIST_MODERATE_CONTENT_TYPE .'users'] = array( |
| 142 |
'#title' => t('users'), |
'#title' => t('users'), |
| 143 |
'#type' => 'checkbox', |
'#type' => 'checkbox', |
| 144 |
'#description' => t('Validate the username is not part of a bad list of words'), |
'#description' => t('Validate the username is not part of a bad list of words'), |
| 145 |
'#return_value' => 1, |
'#return_value' => 1, |
| 146 |
'#default_value' => variable_get(WATCHLIST_MODERATE_CONTENT_TYPE.'users', 0), |
'#default_value' => variable_get(WATCHLIST_MODERATE_CONTENT_TYPE .'users', 0), |
| 147 |
); |
); |
| 148 |
|
|
| 149 |
// Configure which content types are up for pre-moderation - This overrides the moderation from above |
// Configure which content types are up for pre-moderation - This overrides the moderation from above |
| 162 |
'#default_value' => variable_get(WATCHLIST_PREMODERATE_CONTENT_TYPE . $type, 0), |
'#default_value' => variable_get(WATCHLIST_PREMODERATE_CONTENT_TYPE . $type, 0), |
| 163 |
); |
); |
| 164 |
} |
} |
| 165 |
$form['premoderated'][WATCHLIST_PREMODERATE_CONTENT_TYPE.'comments'] = array( |
$form['premoderated'][WATCHLIST_PREMODERATE_CONTENT_TYPE .'comment'] = array( |
| 166 |
'#title' => t('comments'), |
'#title' => t('comment'), |
| 167 |
'#type' => 'checkbox', |
'#type' => 'checkbox', |
| 168 |
'#return_value' => 1, |
'#return_value' => 1, |
| 169 |
'#default_value' => variable_get(WATCHLIST_CONTENT_TYPE.'comments', 0), |
'#default_value' => variable_get(WATCHLIST_PREMODERATE_CONTENT_TYPE .'comment', 0), |
| 170 |
); |
); |
| 171 |
return system_settings_form($form); |
return system_settings_form($form); |
| 172 |
} |
} |
| 173 |
|
|
| 174 |
|
function watchlist_admin_settings_form_validate($form, &$form_state) { |
| 175 |
|
$values = $form_state['values']; |
| 176 |
|
_watchlist_admin_settings_validate_empty_line($values['watchlist_banned_words'], 'watchlist_banned_words'); |
| 177 |
|
_watchlist_admin_settings_validate_empty_line($values['watchlist_words'], 'watchlist_words'); |
| 178 |
|
} |
| 179 |
|
|
| 180 |
|
function _watchlist_admin_settings_validate_empty_line($list, $type) { |
| 181 |
|
$words = str_replace(array("\r\n", "\r"), "\n", $list); |
| 182 |
|
$wordlist = explode("\n", $words); |
| 183 |
|
foreach ($wordlist as $num => $word) { |
| 184 |
|
$trimmed_word = trim($word); |
| 185 |
|
if (empty($trimmed_word)) { |
| 186 |
|
form_set_error($type, t("Please remove all empty line breaks from the %list list", array('%list' => str_replace('_', ' ', $type)))); |
| 187 |
|
return; |
| 188 |
|
} |
| 189 |
|
} |
| 190 |
|
} |
| 191 |
|
|
| 192 |
function watchlist_test_settings_form($form_state) { |
function watchlist_test_settings_form($form_state) { |
| 193 |
$form = array(); |
$form = array(); |
| 194 |
$form['#cache'] = TRUE; |
$form['#cache'] = TRUE; |
| 201 |
$form['test'] = array( |
$form['test'] = array( |
| 202 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 203 |
'#title' => t('Test out watchlist word settings'), |
'#title' => t('Test out watchlist word settings'), |
| 204 |
|
'#description' => t('Test the validity of the watch word list and banned word list.'), |
| 205 |
'#collapsible' => TRUE, |
'#collapsible' => TRUE, |
| 206 |
'#collapsed' => TRUE, |
'#collapsed' => TRUE, |
| 207 |
); |
); |
| 208 |
$form['test']['text'] = array( |
$form['test']['text'] = array( |
| 209 |
'#type' => 'textarea', |
'#type' => 'textarea', |
| 210 |
'#title' => t('Filtered/banned word list'), |
'#title' => t('Test Box'), |
| 211 |
'#cols' => 40, |
'#cols' => 70, |
| 212 |
'#rows' => 10, |
'#rows' => 10, |
| 213 |
'#default_value' => $form_state['values']['text'], |
'#default_value' => $form_state['values']['text'], |
| 214 |
'#description' => t('The banned word list, one per line'), |
'#description' => t('The text you wish to test.'), |
| 215 |
'#required' => TRUE, |
'#required' => TRUE, |
| 216 |
); |
); |
| 217 |
|
|
| 287 |
$text = $comment['subject'] .' '. $comment['comment']; |
$text = $comment['subject'] .' '. $comment['comment']; |
| 288 |
$matches = watchlist_checklist($text); |
$matches = watchlist_checklist($text); |
| 289 |
//Perform the evaluation |
//Perform the evaluation |
| 290 |
watchlist_evaluate($comment, $comment->cid, 'comment', $matches); |
watchlist_evaluate($comment, $comment['cid'], 'comment', $matches); |
| 291 |
break; |
break; |
| 292 |
} |
} |
| 293 |
} |
} |
| 298 |
* Check that a bad name is not used from either the watch or banned lists |
* Check that a bad name is not used from either the watch or banned lists |
| 299 |
*/ |
*/ |
| 300 |
function watchlist_user($op, &$edit, &$account, $category = NULL) { |
function watchlist_user($op, &$edit, &$account, $category = NULL) { |
| 301 |
if (variable_get(WATCHLIST_CONTENT_TYPE.'users', 0)) { |
if (variable_get(WATCHLIST_MODERATE_CONTENT_TYPE .'users', 0)) { |
| 302 |
switch($op) { |
switch($op) { |
| 303 |
case 'validate': |
case 'validate': |
| 304 |
$watchListMatch = watchlist_checklist($edit['name']); |
$watchListMatch = watchlist_checklist($edit['name']); |
| 331 |
if (0 !== variable_get(WATCHLIST_PREMODERATE_CONTENT_TYPE.$type, 0)) { |
if (0 !== variable_get(WATCHLIST_PREMODERATE_CONTENT_TYPE.$type, 0)) { |
| 332 |
$banlist_matches = array_unique($matches['bannedlist'] + $matches['watchlist']); |
$banlist_matches = array_unique($matches['bannedlist'] + $matches['watchlist']); |
| 333 |
if (!empty($banlist_matches)) { |
if (!empty($banlist_matches)) { |
| 334 |
_abuse_report_generated($object, $type, $oid, $matches, TRUE, TRUE); |
_watchlist_report_generated($object, $generic_type, $oid, $matches, TRUE, TRUE); |
| 335 |
} else { |
} else { |
| 336 |
_abuse_report_generated($object, $type, $oid, $matches, TRUE, FALSE); |
_watchlist_report_generated($object, $generic_type, $oid, $matches, TRUE, FALSE); |
| 337 |
} |
} |
| 338 |
|
|
| 339 |
} |
} |
| 340 |
// Check if the content is to be moderated for banned words by the watchlist |
// Check if the content is to be moderated for banned words by the watchlist |
| 341 |
elseif (0 !== variable_get(WATCHLIST_CONTENT_TYPE.$type, 0)) { |
elseif (0 !== variable_get(WATCHLIST_MODERATE_CONTENT_TYPE.$type, 0)) { |
| 342 |
$watchlist_matches = $matches['watchlist']; |
$watchlist_matches = $matches['watchlist']; |
| 343 |
$banlist_matches = $matches['bannedlist']; |
$banlist_matches = $matches['bannedlist']; |
| 344 |
if (!empty($banlist_matches)) { |
if (!empty($banlist_matches)) { |
| 345 |
_abuse_report_generated($object, $type, $oid, $matches['bannedlist'], TRUE, TRUE); |
_watchlist_report_generated($object, $generic_type, $oid, $matches, FALSE, TRUE); |
| 346 |
} |
} |
| 347 |
else if (!empty($watchlist_matches)) { |
else if (!empty($watchlist_matches)) { |
| 348 |
_abuse_report_generated($object, $type, $oid, $matches['watchlist'], FALSE, TRUE); |
_watchlist_report_generated($object, $generic_type, $oid, $matches, FALSE, FALSE); |
| 349 |
} |
} |
| 350 |
} |
} |
| 351 |
} |
} |
| 356 |
function watchlist_checklist($text) { |
function watchlist_checklist($text) { |
| 357 |
$matchlist = array('watchlist' => array(), 'bannedlist' => array()); |
$matchlist = array('watchlist' => array(), 'bannedlist' => array()); |
| 358 |
static $watchlist, $bannedlist; |
static $watchlist, $bannedlist; |
| 359 |
$watch_wordlist = trim(variable_get("watchlist_words", '')); |
$watch_wordlist = variable_get("watchlist_words", ''); |
| 360 |
$banned_wordlist = trim(variable_get("watchlist_banned_words", '')); |
$banned_wordlist = variable_get("watchlist_banned_words", ''); |
| 361 |
if (!isset($watchlist)) { |
if (!isset($watchlist)) { |
| 362 |
$watchlist = _watchlist_generate_list($watch_wordlist); |
$watchlist = _watchlist_generate_list($watch_wordlist); |
| 363 |
} |
} |
| 367 |
// Do some stuff past this stage |
// Do some stuff past this stage |
| 368 |
$matchlist['watchlist'] = _watchlist_checklist($text, $watchlist); |
$matchlist['watchlist'] = _watchlist_checklist($text, $watchlist); |
| 369 |
// This is a special case - currently used on the zt site. |
// This is a special case - currently used on the zt site. |
| 370 |
if (strpos($text, '$!*#')) { |
if (strpos($text, '$!*#') !== FALSE) { |
| 371 |
$matchlist['watchlist'][] = '$!*#'; |
$matchlist['watchlist'][] = '$!*#'; |
| 372 |
} |
} |
| 373 |
$matchlist['bannedlist'] = _watchlist_checklist($text, $bannedlist); |
$matchlist['bannedlist'] = _watchlist_checklist($text, $bannedlist); |
| 383 |
*/ |
*/ |
| 384 |
function _watchlist_generate_list($wordlist) { |
function _watchlist_generate_list($wordlist) { |
| 385 |
$check_set = array(); |
$check_set = array(); |
| 386 |
$words = explode("\n", $wordlist); |
$words = str_replace(array("\r\n", "\r"), "\n", trim($wordlist)); |
| 387 |
//Use what is already readily available thanks to the badwords module |
$words = explode("\n", $words); |
| 388 |
for ($i = 0; $i < count($words); $i++) { |
for ($i = 0; $i < count($words); $i++) { |
| 389 |
$trimmed_word = trim($words[$i]); |
$trimmed_word = trim($words[$i]); |
| 390 |
if (!empty($trimmed_word)) { |
if (!empty($trimmed_word)) { |
| 398 |
* Check the list of words against a list |
* Check the list of words against a list |
| 399 |
*/ |
*/ |
| 400 |
function _watchlist_checklist($text, $wordlist) { |
function _watchlist_checklist($text, $wordlist) { |
| 401 |
if (empty($wordlist)) { |
if(!empty($wordlist)) { |
| 402 |
return array(); |
$matches = array(); |
| 403 |
} |
foreach($wordlist as $word) { |
| 404 |
$replace = '$|$|$|$|$'; |
$match = array(); |
| 405 |
$output = $text; |
if(preg_match($word, $text, $match)) { |
| 406 |
$output = preg_replace($wordlist, $replace, $output); |
$matches[] = $match[0]; |
| 407 |
if (strcmp($output, $text) != 0) { |
} |
| 408 |
$array1 = split(' ', $text); |
} |
| 409 |
$array2 = split(' ', $output); |
return array_unique($matches); |
|
$diff = array_diff($array1, $array2); |
|
|
return $diff; |
|
| 410 |
} |
} |
| 411 |
return array(); |
return array(); |
| 412 |
} |
} |
| 414 |
/** |
/** |
| 415 |
* Generate a report to add to the abuse system. |
* Generate a report to add to the abuse system. |
| 416 |
*/ |
*/ |
| 417 |
function _watchlist_report_generated($type = NULL, $oid = NULL, $matches = array(), $hidden = FALSE, $premoderated = FALSE) { |
function _watchlist_report_generated($object, $type = NULL, $oid = NULL, $matches = array(), $premoderated = TRUE, $hidden = FALSE) { |
| 418 |
|
$found = array_unique($matches['watchlist'] + $matches['bannedlist']); |
| 419 |
|
|
| 420 |
if (!empty($type) && !empty($oid)) { |
if (!empty($type) && !empty($oid)) { |
| 421 |
$admin = array('uid' => 0, |
$admin = array('uid' => 0, |
| 422 |
'name' => 'AUTO_ADMIN', |
'name' => t('Watchlist'), |
| 423 |
'mail' => variable_get('site_mail', 'AUTO_ADMIN@watchlist_generator.com'), |
'mail' => variable_get('site_mail', 'auto_admin@watchlist_generator.com'), |
| 424 |
'reason' => 5, |
'reason' => 5, |
| 425 |
'body' => 'WATCHLIST: '. |
'body' => implode(', ', $found) |
| 426 |
implode(', ', array_unique($matches['watchlist'])) . |
); |
| 427 |
implode(', ', array_unique($matches['bannedlist'])) |
// Alter status of the content if it is supposed to be premoderated or hidden (value sent by evaluation) |
| 428 |
); |
if ($premoderated || $hidden) { |
|
// Alter status of the content if it is supposed to be premoderated (value sent by evaluation) |
|
|
if ($premoderated || sizeof($matches['bannedlist']) > 0) { |
|
| 429 |
switch($type) { |
switch($type) { |
| 430 |
case 'user': |
case 'user': |
| 431 |
db_query("UPDATE {users} SET status=0 WHERE uid=%d", $oid); |
db_query("UPDATE {users} SET status=0 WHERE uid=%d", $oid); |
| 439 |
} |
} |
| 440 |
} |
} |
| 441 |
|
|
| 442 |
if ($hidden || sizeof($matches['bannedlist'] > 0)) { |
if ($hidden) { |
| 443 |
_abuse_set_status($type, $oid, ABUSE_HIDDEN); |
_abuse_set_status($type, $oid, ABUSE_HIDDEN); |
| 444 |
} else { |
} else { |
| 445 |
_abuse_set_status($type, $oid, ABUSE_PENDING); |
_abuse_set_status($type, $oid, ABUSE_PENDING); |
| 446 |
} |
} |
| 447 |
if (sizeof($matches['watchlist']) <= 0 && sizeof($matches['bannedlist']) <= 0) { |
if (sizeof($matches['watchlist']) <= 0 && sizeof($matches['bannedlist']) <= 0) { |
| 448 |
$admin['body'] = t("AUTO MESSAGE: No questionable words were found in this !type", array('!type' => $type)); |
$admin['body'] = t("No watched or banned words found."); |
| 449 |
} |
} |
| 450 |
|
|
| 451 |
if (db_result(db_query("SELECT COUNT(*) FROM {abuse} WHERE type='%s' AND oid=%d AND uid=%d", $type, $oid, $admin['uid'])) == 0) { |
if (db_result(db_query("SELECT COUNT(*) FROM {abuse} WHERE type='%s' AND oid=%d AND uid=%d", $type, $oid, $admin['uid'])) == 0) { |
| 452 |
$aid = db_next_id('{abuse}_aid'); |
db_query("INSERT INTO {abuse} (type, oid, created, body, reason, uid, name, mail) VALUES ('%s', %d, %d, '%s', '%s', %d, '%s', '%s')", |
| 453 |
db_query("INSERT INTO {abuse} (aid, type, oid, created, body, reason, uid, name, mail) VALUES (%d, '%s', %d, %d, '%s', '%s', %d, '%s', '%s')", |
$type, $oid, time(), $admin['body'], $admin['reason'], $admin['uid'], $admin['name'], $admin['mail']); |
|
$aid, $type, $oid, time(), $admin['body'], $admin['reason'], $admin['uid'], $admin['name'], $admin['mail']); |
|
| 454 |
} |
} |
| 455 |
else { |
else { |
| 456 |
db_query("UPDATE {abuse} SET body='%s', created=%d, valid=0 WHERE type='%s' AND oid=%d AND uid=%d AND name='%s' AND mail='%s'", |
db_query("UPDATE {abuse} SET body='%s', created=%d, valid=0 WHERE type='%s' AND oid=%d AND uid=%d AND name='%s' AND mail='%s'", |
| 457 |
$admin['body'], time(), $type, $oid, $admin['uid'], $admin['name'], $admin['mail']); |
$admin['body'], time(), $type, $oid, $admin['uid'], $admin['name'], $admin['mail']); |
| 458 |
} |
} |
| 459 |
} |
} |
| 460 |
} |
} |
|
|
|
|
function _watchlist_report_generated_old($type = NULL, $oid = NULL, $matches = array(), $hidden=1) { |
|
|
$generic_type = ($type === 'comment' || $type === 'user') ? $type : 'node'; |
|
|
if (!empty($type) && !empty($oid)) { |
|
|
$admin = array('uid' => 0, |
|
|
'name' => 'AUTO_ADMIN', |
|
|
'mail' => variable_get('site_mail', 'AUTO_ADMIN@watchlist_generator.com'), |
|
|
'reason' => 5, |
|
|
'body' => 'WATCHLIST: '. implode(', ', array_unique($matches)) |
|
|
); |
|
|
|
|
|
} |
|
|
if (!empty($type) && !empty($oid)) { |
|
|
//A administrative Computer User |
|
|
$admin = array('uid' => 0, |
|
|
'name' => 'AUTO_ADMIN', |
|
|
'mail' => variable_get('site_mail', 'AUTO_ADMIN@watchlist_generator.com'), |
|
|
'reason' => 5, |
|
|
'body' => 'WATCHLIST: '. implode(', ', array_unique($matches)) |
|
|
); |
|
|
if (intval(variable_get('nodes_pre_moderated', 0)) == 1) { |
|
|
switch ($type) { |
|
|
case 'node': |
|
|
db_query("UPDATE {node} SET status=0 WHERE nid=%d", $oid); |
|
|
break; |
|
|
case 'comment': |
|
|
db_query("UPDATE {comments} SET status=1 WHERE cid=%d", $oid); |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
if ($hidden == 1) { //Set status of movie as hidden |
|
|
_abuse_set_status($type, $oid, ABUSE_HIDDEN); |
|
|
} |
|
|
else { |
|
|
_abuse_set_status($type, $oid, ABUSE_PENDING); |
|
|
if (sizeof($matches) <= 0) { |
|
|
$admin['body'] = "AUTO MESSAGE: No questionable words were found in this $type"; |
|
|
} |
|
|
} |
|
|
if (db_result(db_query("SELECT COUNT(*) FROM {abuse} WHERE type='%s' AND oid=%d AND uid=%d", $type, $oid, $admin['uid'])) == 0) { |
|
|
$aid = db_next_id('{abuse}_aid'); |
|
|
db_query("INSERT INTO {abuse} (aid, type, oid, created, body, reason, uid, name, mail) VALUES (%d, '%s', %d, %d, '%s', '%s', %d, '%s', '%s')", |
|
|
$aid, $type, $oid, time(), $admin['body'], $admin['reason'], $admin['uid'], $admin['name'], $admin['mail']); |
|
|
} |
|
|
else { |
|
|
db_query("UPDATE {abuse} SET body='%s', created=%d WHERE type='%s' AND oid=%d AND uid=%d AND name='%s' AND mail='%s'", |
|
|
$admin['body'], time(), $type, $oid, $admin['uid'], $admin['name'], $admin['mail']); |
|
|
} |
|
|
} |
|
|
} |
|