/** * Deletes a given trackback comment * * @param int $cid Comment ID * @param string $sid ID of object comment belongs to * @param string $type Comment type (e.g. article, poll, etc) * @return void * */ function deltrackback($cid, $sid, $type) { global $_TABLES, $LANG_SX00; if (TRB_allowDelete($sid, $type)) { TRB_deleteTrackbackComment($cid); if ($type == 'article') { $tbcount = DB_count($_TABLES['trackback'], array('type', 'sid'), array('article', $sid)); DB_query("UPDATE {$_TABLES['stories']} SET trackbacks = {$tbcount} WHERE sid = '{$sid}'"); } SPAMX_log($LANG_SX00['spamdeleted']); } }
/** * Deletes a trackback comment. Checks if the current user has proper * permissions first. * * @param int $id ID of the trackback comment to delete * @return string HTML redirect * */ function deleteTrackbackComment($id) { global $_TABLES; $cid = DB_escapeString($id); $result = DB_query("SELECT sid,type FROM {$_TABLES['trackback']} WHERE cid = '{$cid}'"); list($sid, $type) = DB_fetchArray($result); $url = PLG_getItemInfo($type, $sid, 'url'); if (TRB_allowDelete($sid, $type)) { TRB_deleteTrackbackComment($id); if ($type == 'article') { DB_query("UPDATE {$_TABLES['stories']} SET trackbacks = trackbacks - 1 WHERE (sid = '{$sid}')"); } $msg = 62; } else { $msg = 63; } if (strpos($url, '?') === false) { $url .= '?msg=' . $msg; } else { $url .= '&msg=' . $msg; } return COM_refresh($url); }
/** * Deletes a trackback comment. Checks if the current user has proper * permissions first. * * @param int $id ID of the trackback comment to delete * @return string HTML redirect * */ function TRACKBACK_delete($id) { global $_TABLES; $cid = DB_escapeString($id); $result = DB_query("SELECT sid,type FROM {$_TABLES['trackback']} WHERE cid = '{$cid}'"); list($sid, $type) = DB_fetchArray($result); $url = TRACKBACK_getItemInfo($type, $sid, 'url'); if (TRB_allowDelete($sid, $type)) { TRB_deleteTrackbackComment($id); if ($type == 'article') { DB_query("UPDATE {$_TABLES['stories']} SET trackbacks = trackbacks - 1 WHERE (sid = '{$sid}')"); CACHE_remove_instance('story_' . $sid); } $msg = 62; } else { $msg = 63; } COM_setMessage($msg); return COM_refresh($url); }