X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=inc%2Ftemplate.php;h=dc913bd07435df1397f9335dcae2996cbc1d26d5;hb=d6146cd913072d2e2a9d78b916751df84c297821;hp=81c0b93d4cdead9e0019e9a1f8b30027e6d1b532;hpb=fee3219cb9e4a505c4a368d879ea3bde6b6e27a3;p=contagged diff --git a/inc/template.php b/inc/template.php index 81c0b93..dc913bd 100644 --- a/inc/template.php +++ b/inc/template.php @@ -27,6 +27,11 @@ function tpl_std(){ $smarty->assign('lang',$lang); $smarty->assign('fields',$FIELDS); $smarty->assign('lettertabs',explode(' ',$lang['lettertabs'])); + + if(isset($FIELDS['country'])){ + include dirname(__FILE__).'/iso3166.php'; + $smarty->assign('iso3166',$iso3166); + } } /** @@ -76,6 +81,8 @@ function tpl_entry($in){ // join marker field to markers if(is_array($out['marker'])) $out['markers'] = join(', ',$out['marker']); + $out['qrcode'] = tpl_qrcode($out); + /* print '
';
 print_r($out);
@@ -85,6 +92,20 @@ print '
'; $smarty->assign('entry',$out); } +function tpl_qrcode($in){ + $data = "BEGIN:VCARD\n"; + $data .= "N:{$in['name']};{$in['givenname']}\n"; + if($in['mobile']) $data .= "TEL;CELL:{$in['mobile']}\n"; + if($in['phone']) $data .= "TEL;WORK:{$in['phone']}\n"; + if($in['homephone']) $data .= "TEL;HOME:{$in['homephone']}\n"; + if($in['mail'][0]) $data .= "EMAIL:{$in['mail'][0]}\n"; + $data .= "END:VCARD"; + $data = rawurlencode($data); + + return 'http://chart.apis.google.com/chart?cht=qr&chld=L|5&chs=500x500&chl='.$data.'&.png'; +} + + /** * assigns the last LDAP error to the template */ @@ -96,9 +117,9 @@ function tpl_ldaperror($message=""){ if($errno){ $__LDAPERROR__ .= ldap_err2str($errno); if(!empty($message)){ - $__LDAPERROR__ .= "($message)"; + $__LDAPERROR__ .= " ($message)"; }elseif($errno == 4){ - $__LDAPERROR__ .= "(You need to increase this limit in your server config)"; + $__LDAPERROR__ .= " (You need to increase this limit in your server config)"; } $__LDAPERROR__ .= '
'; }