/[ldap]/html/vizitka.cgi
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 /html/vizitka.cgi

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

revision 1.1 by dpavlin, Wed May 24 17:38:45 2000 UTC revision 1.2 by dpavlin, Wed May 24 17:39:36 2000 UTC
# Line 20  $ldap->bind;   # anonymous Line 20  $ldap->bind;   # anonymous
20          'sn'=>'prezime',          'sn'=>'prezime',
21          'cn'=>'ime i prezime');          'cn'=>'ime i prezime');
22    
23    %utf2iso_tab = (
24    0x0161 => 'š', 0x0111 => 'đ', 0x010d => 'č', 0x0107 => 'ć', 0x017e => 'ž',
25    0x0160 => 'Š', 0x0110 => 'Đ', 0x010c => 'Č', 0x0106 => 'Ć', 0x017d => 'Ž'
26    );
27    
28  print header(-type => 'text/html;charset=UTF-8'),  sub utf2iso {
29            my $out;
30            foreach (@_) {
31                    s/([\xC0-\xDF])([\x80-\xBF])/$utf2iso_tab{unpack("c",$1)<<6&0x07C0|unpack("c",$2)&0x003F}/ge;
32                    s/([\xE0-\xEF])([\x80-\xBF])([\x80-\xBF])/$utf2iso_tab{unpack("c",$1)<<12&0xF000|unpack("c",$2)<<6&0x0FC0|unpack("c",$3)&0x003F}/ge;
33                    s/([\xF0-\xF7])([\x80-\xBF])([\x80-\xBF])([\x80-\xBF])/$utf2iso_tab{unpack("c",$1)<<18&0x1C0000|unpack("c",$2)<<12&0x3F000|unpack("c",$3)<<6&0x0FC0|unpack("c",$4)&0x003F}/ge;
34                    $out.=$_;
35            }
36            return $out;
37    }
38    
39    print
40    #       header(-type => 'text/html;charset=UTF-8'),
41            header,
42          start_html('Naručivanje vizitki'),          start_html('Naručivanje vizitki'),
43          start_form,          start_form,
44          "Upišite svoje ",popup_menu(-name=>'what',          "Upišite svoje ",popup_menu(-name=>'what',
# Line 51  if(param()) { Line 68  if(param()) {
68                  for($i = 0 ; $i < $max ; $i++) {                  for($i = 0 ; $i < $max ; $i++) {
69                          my $entry = $mesg->entry($i);                          my $entry = $mesg->entry($i);
70                          my ($mail) = $entry->get('mail'); # array, take first                          my ($mail) = $entry->get('mail'); # array, take first
71                          my ($cn)=$entry->get('cn');                          my ($cn)=utf2iso($entry->get('cn'));
72                          push @radio_vals,$cn;                          push @radio_vals,$cn;
73                          $radio_labels{$cn}=$cn;                          $radio_labels{$cn}=$cn;
74                  }                  }
# Line 91  if(param()) { Line 108  if(param()) {
108                  close(LOG);                  close(LOG);
109          }          }
110  }  }
111    

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

  ViewVC Help
Powered by ViewVC 1.1.26