]> ruin.nu Git - ndwebbie.git/blobdiff - ND/Include.pm
mark threads as read
[ndwebbie.git] / ND / Include.pm
index 796ed68dbd10acabcc81244d97d295d335044e20..e51d0e6b81bae9c9f849e9d390126e98258e52af 100644 (file)
 package ND::Include;
 use strict;
 use warnings FATAL => 'all';
+use CGI qw{:standard};
 require Exporter;
 
 our @ISA = qw/Exporter/;
 
-our @EXPORT = qw/isMember isHC isDC isBC isOfficer isScanner isIntel parseMarkup min max listTargets
-       alliances intelquery generateClaimXml/;
+our @EXPORT = qw/isMember isHC isDC isBC isOfficer isScanner isIntel isTech parseMarkup min max listTargets
+       alliances intelquery generateClaimXml markThreadAsRead/;
 
 sub isMember {
-       return exists $ND::GROUPS{Members};
+       return exists $ND::GROUPS{Members} || isTech();
 }
 
 sub isHC {
-       return exists $ND::GROUPS{HC};
+       return exists $ND::GROUPS{HC} || isTech();
 }
 
 sub isDC {
-       return exists $ND::GROUPS{DC};
+       return exists $ND::GROUPS{DC} || isTech();
 }
 
 sub isBC {
-       return exists $ND::GROUPS{BC};
+       return exists $ND::GROUPS{BC} || isTech();
 }
 
 sub isOfficer {
-       return exists $ND::GROUPS{Officers};
+       return exists $ND::GROUPS{Officers} || isTech();
 }
 
 sub isScanner {
-       return exists $ND::GROUPS{Scanners};
+       return exists $ND::GROUPS{Scanners} || isTech();
 }
 
 sub isIntel {
-       return exists $ND::GROUPS{Intel};
+       return exists $ND::GROUPS{Intel} || isTech();
+}
+
+sub isTech {
+       return exists $ND::GROUPS{Tech};
 }
 
 sub parseMarkup {
@@ -63,6 +68,18 @@ sub parseMarkup {
        return $text;
 }
 
+sub markThreadAsRead {
+       my ($thread) = @_;
+       my $rows = $ND::DBH->do(q{UPDATE forum_thread_visits SET time = now() 
+WHERE uid =    $1 AND ftid = $2},undef,$ND::UID,$thread);
+       if ($rows == 0){
+               $ND::DBH->do(q{INSERT INTO forum_thread_visits (uid,ftid) VALUES ($1,$2)}
+                       ,undef,$ND::UID,$thread) or $ND::ERROR .= p($ND::DBH->errstr);
+       }else{
+               $ND::ERROR .= p($ND::DBH->errstr);
+       }
+}
+
 sub min {
     my ($x,$y) = @_;
     return ($x > $y ? $y : $x);