function antispam_content_load in AntiSpam 6
Same name and namespace in other branches
- 7 antispam.module \antispam_content_load()
Load a node or a comment.
Parameters
string Content type; can be either 'node' or 'comment'.:
integer Content ID; can be either a nid or a cid.:
Return value
mixed An object with requested content; FALSE on failure.
7 calls to antispam_content_load()
- antispam_callback_set_published_status in ./
antispam.module - Menu callback; publish/unpublish content.
- antispam_callback_set_spam_status in ./
antispam.module - Menu callback; mark/unmark content as spam.
- antispam_confirm_multiple_operation in ./
antispam.admin.inc - List the selected items and verify that the admin really wants to delete them.
- antispam_confirm_multiple_operation_submit in ./
antispam.admin.inc - confirm_form callback; perform the actual operation against selected content.
- antispam_content_delete in ./
antispam.module - Delete a node or a comment.
File
- ./
antispam.module, line 1649
Code
function antispam_content_load($content_type, $content_id) {
if ($content_type == 'node') {
$content = node_load($content_id);
if (empty($content->nid)) {
$content = FALSE;
}
}
else {
if ($content_type == 'comment') {
$content = db_fetch_object(db_query(db_rewrite_sql('SELECT c.*, u.name AS registered_name FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE c.cid = %d', 'c'), $content_id));
if (empty($content->cid)) {
$content = FALSE;
}
else {
$rec = db_fetch_object(db_query('SELECT signature, spaminess FROM {antispam_spam_marks} WHERE content_type = \'comment\' AND content_id = %d', $content->cid));
if ($rec) {
$content->signature = $rec->signature;
$content->spaminess = $rec->spaminess;
}
else {
$content->signature = '';
$content->spaminess = '';
}
if ($content->uid == 0) {
$content->name = variable_get('anonymous', t('Anonymous'));
}
else {
if ($content->uid) {
$content->name = $content->registered_name;
}
}
}
}
else {
$content = FALSE;
}
}
return $content;
}