You are here

function ua_logger_comment in User Agent Logger 5

Same name and namespace in other branches
  1. 6 ua_logger.module \ua_logger_comment()

File

./ua_logger.module, line 23

Code

function ua_logger_comment(&$comment, $op) {
  switch ($op) {
    case 'insert':
      db_query('INSERT INTO {ua_logger} (xid, type, ua) VALUES(%d, "%s", "%s")', $comment['cid'], 'comment', $_SERVER['HTTP_USER_AGENT']);
      break;
    case 'view':
      if (user_access('view user agents')) {
        $result = db_fetch_object(db_query('SELECT ua FROM {ua_logger} WHERE type="comment" AND xid = %d', $comment->cid));
        $comment->useragent = $result->ua;
      }
      break;
  }
}