/[useradm]/otvori_nove+db
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /otvori_nove+db

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by dpavlin, Wed Apr 12 09:10:20 2000 UTC revision 1.3 by dpavlin, Tue Apr 18 12:09:03 2000 UTC
# Line 14  use strict; Line 14  use strict;
14    
15  my $debug=0;  my $debug=0;
16    
17  $debug++ if (defined($ARGV[0]) && $ARGV[0] eq "-d");  if (defined($ARGV[0]) && $ARGV[0] eq "-d") {
18  my $open_only_id=$ARGV[0] if (defined($ARGV[0]));          $debug++;
19            shift @ARGV;
20    }
21    my $open_only_id=shift @ARGV if (defined($ARGV[0]));
22    
23  warn "DEBUG -- me kreira ništa!" if ($debug);  warn "DEBUG -- me kreira ništa!" if ($debug);
24    
25  $|++;  $|++;
26    
 my @mail_to;            # array to main initial message to  
 open(WHO,"who am i |") || die "who am i? $!";  
 my $db_user=<WHO>;  
 $db_user=~s/\s.+$//g;  
 close(WHO);  
27    
28  #----  #----
29    
# Line 40  my %etc_aliases; Line 38  my %etc_aliases;
38  my $mail_alias;  my $mail_alias;
39  my $mail_login;  my $mail_login;
40    
41    my @mail_to;            # array to main initial message to
42    open(WHO,"who am i |") || die "who am i? $!";
43    my $db_user=<WHO>;
44    $db_user=~s/\s.+$//g;
45    close(WHO);
46    
47    xdebug "koristim korinika $db_user\n";
48    
49    
50  v "/etc/aliases\n";  v "/etc/aliases\n";
51  open(ALIAS,"/etc/aliases") || die "Can't open /etc/aliases: $!";  open(ALIAS,"/etc/aliases") || die "Can't open /etc/aliases: $!";
52  open(NALIAS,">aliases.new") || die "Can't open aliases.new: $!";  open(NALIAS,">aliases.new") || die "Can't open aliases.new: $!";
# Line 108  if (! defined($open_only_id)) { Line 115  if (! defined($open_only_id)) {
115    
116  }  }
117  $sth->execute() || die $sth->errstr();  $sth->execute() || die $sth->errstr();
118    
119    
120    my $sth2;
121    
122  while (my ($osoba_id,$ime,$prezime,$sifra,$objekt,$kat,$soba,$shell) = $sth->fetchrow_array() ) {  while (my ($osoba_id,$ime,$prezime,$sifra,$objekt,$kat,$soba,$shell) = $sth->fetchrow_array() ) {
123    
124            $sth2 = $dbh->prepare("select max(status_tip_id) from status where osoba_id = $osoba_id") || die $dbh->errstr();
125            $sth2->execute() || die $sth2->errstr();
126            my ($max_status) = $sth2->fetchrow_array();
127            xdebug "max status zahtjeva $osoba_id je $max_status\n";
128            next if ($max_status > 3);      # 3 .. otvoren
129    
130          next if ($ime eq "ime" || $prezime eq "prezime");          next if ($ime eq "ime" || $prezime eq "prezime");
131    
132          if (!defined($ime) || !defined($prezime) || $ime eq "" || $prezime eq "") {          if (!defined($ime) || !defined($prezime) || $ime eq "" || $prezime eq "") {
# Line 152  while (my ($osoba_id,$ime,$prezime,$sifr Line 169  while (my ($osoba_id,$ime,$prezime,$sifr
169          my $group="users";          my $group="users";
170    
171          if (defined($etc_passwd{$login})) {          if (defined($etc_passwd{$login})) {
172                  xerror "preskocen: $ime $prezime (postoji isti login $login)\n";                  xerror "preskocen: $ime $prezime osoba_id=$osoba_id (postoji isti login $login)\n";
173                  $dbh->do("insert into status (osoba_id,kontakt_osoba_id,datum,status_tip_id) values ($osoba_id,3,'now'::datetime,4)") if (! $debug);                  $dbh->do("insert into status (osoba_id,kontakt_osoba_id,datum,status_tip_id) values ($osoba_id,3,'now'::datetime,4)") if (! $debug);
174                  next;                  next;
175          }          }
# Line 194  while (my ($osoba_id,$ime,$prezime,$sifr Line 211  while (my ($osoba_id,$ime,$prezime,$sifr
211          $etc_passwd{$login}=$full_name;          $etc_passwd{$login}=$full_name;
212    
213          if (defined($etc_aliases{$email_alias})) {          if (defined($etc_aliases{$email_alias})) {
214                  xerror "upozorenje: $ime $prezime (postoji e-mail alias) -- $email_alias\n";                  xerror "upozorenje: $ime $prezime osoba_id=$osoba_id (postoji e-mail alias) -- $email_alias\n";
215                  print NALIAS "$email_alias:\t$login,$etc_aliases{$email_alias}\n";                  print NALIAS "$email_alias:\t$login,$etc_aliases{$email_alias}\n";
216          } else {          } else {
217                  print NALIAS "$email_alias:\t$login\n";                  print NALIAS "$email_alias:\t$login\n";

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

  ViewVC Help
Powered by ViewVC 1.1.26