]> ruin.nu Git - ndwebbie.git/commitdiff
better intel messages subjects
authorMichael Andreen <harv@ruin.nu>
Fri, 5 Jan 2007 23:05:48 +0000 (23:05 +0000)
committerMichael Andreen <harv@ruin.nu>
Fri, 5 Jan 2007 23:05:48 +0000 (23:05 +0000)
addintel.pl
templates/addintel.tmpl

index fe21d0412b66dfd44aad8d39ef55c0cb8bead29f..b3d5aed99abfdd588fb142a33180f39011792982 100644 (file)
@@ -25,6 +25,7 @@ $ND::TEMPLATE->param(TITLE => 'Add Intel and Scans');
 
 our $BODY;
 our $DBH;
+our $ERROR;
 my $error;
 
 die "You don't have access" unless isMember();
@@ -63,7 +64,14 @@ if (defined param('cmd')){
        }
        if (param('cmd') eq 'submit_message'){
                my $board = {id => 12};
-               if (my $thread = addForumThread $DBH,$board,$ND::UID,param('subject')){
+               my $subject = param('subject');
+               unless ($subject){
+                       if (param('intel') =~ /(.*\w.*)/){
+                               $subject = $1;
+                       }
+                       
+               }
+               if (my $thread = addForumThread $DBH,$board,$ND::UID,$subject){
                        $error .= p 'Intel message added' if addForumPost $DBH,$thread,$ND::UID,param('intel')
                }
        }
index a0483b6dc5b811152d50eda71a4d0e556620ccd6..e2e55cb533e572778049e25c5f7cfd9158e14ace 100644 (file)
@@ -18,6 +18,6 @@
        <textarea rows="20" cols="50" name="intel"></textarea>
        <input type="hidden" name="cmd" value="submit_message"/>
        <input type="hidden" name="page" value="<TMPL_VAR NAME=PAGE>"/>
-       <br/>Subject: <input type="text" name="subject" value="New intel message"/>
+       <br/>Subject: <input type="text" name="subject" value=""/>
        <input type="submit" value="Submit"/>
 </fieldset></form>