/[drupal]/contributions/modules/ua_logger/ua_logger.module
ViewVC logotype

Contents of /contributions/modules/ua_logger/ua_logger.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Sun Jul 8 04:19:53 2007 UTC (2 years, 4 months ago) by daryl
Branch: MAIN
CVS Tags: DRUPAL-5--1-2, HEAD
Branch point for: DRUPAL-6--1
Changes since 1.2: +4 -4 lines
File MIME type: text/x-php
applying patch submitted at http://drupal.org/node/157624
1 <?php
2
3 function ua_logger_perm(){
4 return array('view user agents');
5 }
6
7 function ua_logger_nodeapi(&$node, $op){
8 switch($op){
9 case 'insert':
10 db_query("INSERT INTO {ua_logger} (xid, type, ua) VALUES(%d, '%s', '%s')", $node->nid, 'node', $_SERVER['HTTP_USER_AGENT']);
11 break;
12 case 'view':
13 if(user_access('view user agents')){
14 $result = db_fetch_object(db_query("SELECT ua FROM {ua_logger} WHERE type='node' AND xid = %d", $node->nid));
15 if($result->ua){
16 $node->useragent = $result->ua;
17 }
18 }
19 break;
20 }
21 }
22
23 function ua_logger_comment(&$comment, $op){
24 switch($op){
25 case 'insert':
26 db_query("INSERT INTO {ua_logger} (xid, type, ua) VALUES(%d, '%s', '%s')", $comment['cid'], 'comment', $_SERVER['HTTP_USER_AGENT']);
27 break;
28 case 'view':
29 if(user_access('view user agents')){
30 $result = db_fetch_object(db_query("SELECT ua FROM {ua_logger} WHERE type='comment' AND xid = %d", $comment->cid));
31 $comment->useragent = $result->ua;
32 }
33 break;
34 }
35 }
36
37 ?>

  ViewVC Help
Powered by ViewVC 1.1.2