[BACK]Return to keyring.cgi CVS log [TXT][DIR] Up to [local] / palm / Palm-Keyring / examples / cgi / bin

Diff for /palm/Palm-Keyring/examples/cgi/bin/keyring.cgi between version 1.1 and 1.3

version 1.1, 2009/06/11 21:40:45 version 1.3, 2009/06/16 02:39:09
Line 1 
Line 1 
 #!/usr/bin/perl  #!/usr/bin/perl
 # $RedRiver$  # $RedRiver: keyring.cgi,v 1.2 2009/06/15 17:45:46 andrew Exp $
 ########################################################################  ########################################################################
 # keyring.cgi *** Update and modify keyring files  # keyring.cgi *** Update and modify keyring files
 #  #
Line 25 
Line 25 
 use Palm::Keyring;  use Palm::Keyring;
 use Template;  use Template;
   
 my $base_path = '/keyring';  my $base_path = '/users';
 my $keyring_path = catdir($base_path, 'rings');  my $dir = $ENV{'PATH_INFO'} || '/';
 my $dir       = $ENV{'PATH_INFO'} || '/';  
   
 my $query = CGI->new();  my $query = CGI->new();
 my $tt  my $tt    = Template->new( { INCLUDE_PATH => catdir('../templates') } );
     = Template->new( { INCLUDE_PATH => catdir( $base_path, 'templates' ) } );  my $pjx   = new CGI::Ajax(
 my $pjx = new CGI::Ajax(  
     changeFile     => \&change_file,      changeFile     => \&change_file,
     changeCategory => \&change_category,      changeCategory => \&change_category,
     changeRecord   => \&change_record,      changeRecord   => \&change_record,
Line 41 
Line 39 
 #$pjx->JSDEBUG(1);  #$pjx->JSDEBUG(1);
 #$pjx->DEBUG(1);  #$pjx->DEBUG(1);
   
 my $password = $query->param('password');  my $password = $query->param('unlock_password');
 my $file     = $query->param('file') || '';  my $file     = $query->param('file') || '';
 my $category = $query->param('category');  my $category = $query->param('category');
 my $record   = $query->param('record');  my $record   = $query->param('record');
Line 51 
Line 49 
 }  }
   
 $file = canonpath($file) if $file;  $file = canonpath($file) if $file;
   $dir  = canonpath($dir)  if $dir;
   
 if ( $file =~ /^ \Q$keyring_path\E /xms ) {  if ( $dir =~ m{/\.\.//}xms ) {
       error('Invalid Dir [$dir]');
       $dir = '';
   }
   
   if ( $file =~ /^ \Q$base_path\E /xms ) {
     $dir = dirname($file);      $dir = dirname($file);
 }  }
 else {  else {
     $dir = catdir( $keyring_path, $dir );      $dir = catdir( $base_path, $dir, 'rings' );
   }
   
     files() if !$file;  files() if !$file;
   
     if ( !$file ) {  if ( !$file ) {
         error("no file in [$dir]!");      error("No Keyrings in [$dir]!");
     }  }
   
     if ( $dir && $file ) {  if ( $dir && $file ) {
         if ( !-d $dir ) {      $file = catfile( $dir, basename($file) );
             error("Path [$dir] does not exist!");      error("Dir [$dir] does not exist!")   if !-d $dir;
         }      error("File [$file] does not exist!") if !-e $file;
         $file = catfile( $dir, basename($file) );  
     }  
 }  }
   
 print $pjx->build_html( $query, \&Show_HTML );  print $pjx->build_html( $query, \&Show_HTML );
   
 #print $query->header(), Show_HTML();  #print $query->header(), Show_HTML();
   
 sub Show_HTML {  sub Show_HTML {
Line 116 
Line 120 
         else {          else {
             return              return
                   'Unlocked: '                    'Unlocked: '
                 . $query->hidden( 'password', $password )                  . $query->hidden( 'unlock_password', $password )
                 . $query->submit( -name => 'lock', -value => 'Lock', );                  . $query->submit( -name => 'lock', -value => 'Lock', );
         }          }
     }      }
   
     return 'Password: '      return 'Locked - Enter Password to Unlock: ' . $query->br()
         . $query->password_field(          . $query->password_field(
         -name     => 'password',          -name     => 'unlock_password',
         -value    => '',          -value    => '',
         -override => 1,          -override => 1,
         );          );
Line 148 
Line 152 
                 -default  => $file,                  -default  => $file,
                 -onChange => "changeFile("                  -onChange => "changeFile("
                     . "['file'],"                      . "['file'],"
                     . "['passwords','files','categories','lists','records','errors']);",                      . "['unlock_passwords','files','categories','lists','records','errors']);",
             );              );
         }          }
         else {          else {
Line 180 
Line 184 
         -default  => $category,          -default  => $category,
         -labels   => \%categories,          -labels   => \%categories,
         -onChange => "changeCategory("          -onChange => "changeCategory("
             . "['password','file','category'],"              . "['unlock_password','file','category'],"
             . "['lists','errors'], 'POST');",              . "['lists','errors'], 'POST');",
     );      );
 }  }
Line 207 
Line 211 
         ],          ],
         -default  => [$record],          -default  => [$record],
         -labels   => \%records,          -labels   => \%records,
         -size     => 25,  
         -onChange => "changeRecord("          -onChange => "changeRecord("
             . "['password','file','record'],"              . "['unlock_password','file','record'],"
             . "['records','errors'], 'POST');",              . "['records','errors'], 'POST');",
     );      );
 }  }
Line 267 
Line 270 
             $label = 'Last Change';              $label = 'Last Change';
         }          }
   
           my $type = 'textfield';
           if ($key eq 'notes') {
               $type = 'textarea';
           }
   
         $output          $output
             .= $label . ': '              .= $label . ': '
             . $query->textfield(              . $query->$type(
             -name     => 'acct_' . $key,              -name     => 'acct_' . $key,
             -value    => $acct{$key}{data},              -value    => $acct{$key}{data},
             -override => 1,              -override => 1,

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>