added group PDF, display attribute names bold and values normal
This commit is contained in:
parent
72e6f80c55
commit
42bb1192e7
325
lam/lib/pdf.inc
325
lam/lib/pdf.inc
|
@ -53,47 +53,48 @@ function createUserPDF($accounts) {
|
||||||
$key = base64_decode($_COOKIE['Key']);
|
$key = base64_decode($_COOKIE['Key']);
|
||||||
$pdfFile->addPage();
|
$pdfFile->addPage();
|
||||||
// Print Personal settings
|
// Print Personal settings
|
||||||
|
$pdfFile->setFont("arial","B",12);
|
||||||
$pdfFile->Write(5,"- " . _("Personal User Infos") . ":");
|
$pdfFile->Write(5,"- " . _("Personal User Infos") . ":");
|
||||||
$pdfFile->Ln(6);
|
$pdfFile->Ln(6);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("Title") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("Title") . ":",0,0,"R",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->personal_title,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->personal_title,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("Surname") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("Surname") . ":",0,0,"R",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->general_surname,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->general_surname,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("Given name") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("Given name") . ":",0,0,"R",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->general_givenname,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->general_givenname,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("Street") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("Street") . ":",0,0,"R",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->personal_street,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->personal_street,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("Postal code") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("Postal code") . ":",0,0,"R",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->personal_postalCode,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->personal_postalCode,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("Postal address") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("Postal address") . ":",0,0,"R",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->personal_postalAddress,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->personal_postalAddress,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("E-Mail") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("E-Mail") . ":",0,0,"R",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->personal_mail,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->personal_mail,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("Phone") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("Phone") . ":",0,0,"R",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->personal_telephoneNumber,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->personal_telephoneNumber,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("Cellular phone") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("Cellular phone") . ":",0,0,"R",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
|
||||||
$pdfFile->Cell(50,5,$account->personal_mobileTelephoneNumber,0,1,"L",0);
|
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,_("Facsimile") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,$account->personal_mobileTelephoneNumber,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Cell(50,5,_("Facsimile") . ":",0,0,"R",0);
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->personal_facsimileTelephoneNumber,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->personal_facsimileTelephoneNumber,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","",10);
|
||||||
// Print Unix settings
|
// Print Unix settings
|
||||||
|
@ -101,15 +102,14 @@ function createUserPDF($accounts) {
|
||||||
$pdfFile->setFont("arial","B",12);
|
$pdfFile->setFont("arial","B",12);
|
||||||
$pdfFile->Write(5,"- " . _("Unix User Settings") . ":");
|
$pdfFile->Write(5,"- " . _("Unix User Settings") . ":");
|
||||||
$pdfFile->Ln(6);
|
$pdfFile->Ln(6);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("Username") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("Username") . ":",0,0,"R",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->general_username,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->general_username,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","",10);
|
|
||||||
if($account->unix_password_no == "1") {
|
if($account->unix_password_no == "1") {
|
||||||
$pdfFile->setFont("times","",10);
|
|
||||||
$pdfFile->Cell(50,5,_("Unix password") . ":",0,0,"R",0);
|
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Cell(50,5,_("Unix password") . ":",0,0,"R",0);
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,_("Unix password disabled!"),0,1,"L",0);
|
$pdfFile->Cell(50,5,_("Unix password disabled!"),0,1,"L",0);
|
||||||
}
|
}
|
||||||
elseif($account->unix_password == "") {
|
elseif($account->unix_password == "") {
|
||||||
|
@ -117,58 +117,57 @@ function createUserPDF($accounts) {
|
||||||
else {
|
else {
|
||||||
$account->unix_password = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, base64_decode($account->unix_password), MCRYPT_MODE_ECB, $iv);
|
$account->unix_password = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, base64_decode($account->unix_password), MCRYPT_MODE_ECB, $iv);
|
||||||
$account->unix_password = str_replace(chr(00), '', $account->unix_password);
|
$account->unix_password = str_replace(chr(00), '', $account->unix_password);
|
||||||
$pdfFile->setFont("times","",10);
|
|
||||||
$pdfFile->Cell(50,5,_("Unix password") . ":",0,0,"R",0);
|
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Cell(50,5,_("Unix password") . ":",0,0,"R",0);
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->unix_password,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->unix_password,0,1,"L",0);
|
||||||
}
|
}
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("Group(s)") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("Group(s)") . ":",0,0,"R",0);
|
||||||
$text = $account->general_group;
|
$text = $account->general_group;
|
||||||
$groups = $account->general_groupadd;
|
$groups = $account->general_groupadd;
|
||||||
for($j=0;$j<count($groups);$j++) {
|
for($j=0;$j<count($groups);$j++) {
|
||||||
$text .= ", " . $groups[$j];
|
$text .= ", " . $groups[$j];
|
||||||
}
|
}
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$text,0,1,"L",0);
|
$pdfFile->Cell(50,5,$text,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","",10);
|
|
||||||
$pdfFile->Cell(50,5,_("Home Directory") . ":",0,0,"R",0);
|
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,$account->general_homedir,0,1,"L",0);
|
$pdfFile->Cell(50,5,_("Home Directory") . ":",0,0,"R",0);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","",10);
|
||||||
|
$pdfFile->Cell(50,5,$account->general_homedir,0,1,"L",0);
|
||||||
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("Login Shell") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("Login Shell") . ":",0,0,"R",0);
|
||||||
$text = "";
|
$text = "";
|
||||||
$shells = $account->general_shell;
|
$shells = $account->general_shell;
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->general_shell,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->general_shell,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("Password expire") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("Password expire") . ":",0,0,"R",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
|
||||||
$pdfFile->Cell(50,5,date('j. F Y' ,$account->unix_pwdexpire),0,1,"L",0);
|
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,_("Login at host(s)") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,date('j. F Y' ,$account->unix_pwdexpire),0,1,"L",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Cell(50,5,_("Login at host(s)") . ":",0,0,"R",0);
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->unix_host,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->unix_host,0,1,"L",0);
|
||||||
// Print Samba settings
|
// Print Samba settings
|
||||||
$pdfFile->Ln(9);
|
$pdfFile->Ln(9);
|
||||||
$pdfFile->setFont("arial","B",12);
|
$pdfFile->setFont("arial","B",12);
|
||||||
$pdfFile->Write(5,"- " . _("Windows User Settings") . ":");
|
$pdfFile->Write(5,"- " . _("Windows User Settings") . ":");
|
||||||
$pdfFile->Ln(6);
|
$pdfFile->Ln(6);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("Username") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("Username") . ":",0,0,"R",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->general_username,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->general_username,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","",10);
|
|
||||||
if($account->smb_password_no == "1") {
|
if($account->smb_password_no == "1") {
|
||||||
$pdfFile->setFont("times","",10);
|
|
||||||
$pdfFile->Cell(50,5,_("Windows password") . ":",0,0,"R",0);
|
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Cell(50,5,_("Windows password") . ":",0,0,"R",0);
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,_("Window password disabled!"),0,1,"L",0);
|
$pdfFile->Cell(50,5,_("Window password disabled!"),0,1,"L",0);
|
||||||
}
|
}
|
||||||
elseif($account->smb_useunixpwd == "1") {
|
elseif($account->smb_useunixpwd == "1") {
|
||||||
$pdfFile->setFont("times","",10);
|
|
||||||
$pdfFile->Cell(50,5,_("Windows password") . ":",0,0,"R",0);
|
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Cell(50,5,_("Windows password") . ":",0,0,"R",0);
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,_("Windows password set to unix password."),0,1,"L",0);
|
$pdfFile->Cell(50,5,_("Windows password set to unix password."),0,1,"L",0);
|
||||||
}
|
}
|
||||||
elseif($account->smb_password == "") {
|
elseif($account->smb_password == "") {
|
||||||
|
@ -176,34 +175,34 @@ function createUserPDF($accounts) {
|
||||||
else {
|
else {
|
||||||
$account->smb_password = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, base64_decode($account->smb_password), MCRYPT_MODE_ECB, $iv);
|
$account->smb_password = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, base64_decode($account->smb_password), MCRYPT_MODE_ECB, $iv);
|
||||||
$account->smb_password = str_replace(chr(00), '', $account->smb_password);
|
$account->smb_password = str_replace(chr(00), '', $account->smb_password);
|
||||||
$pdfFile->setFont("times","",10);
|
|
||||||
$pdfFile->Cell(50,5,_("Windows password") . ":",0,0,"R",0);
|
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Cell(50,5,_("Windows password") . ":",0,0,"R",0);
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->smb_password,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->smb_password,0,1,"L",0);
|
||||||
}
|
}
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("Home drive") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("Home drive") . ":",0,0,"R",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->smb_homedrive,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->smb_homedrive,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("Script path") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("Script path") . ":",0,0,"R",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->smb_scriptPath,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->smb_scriptPath,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("Profile path") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("Profile path") . ":",0,0,"R",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->smb_profilePath,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->smb_profilePath,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("Login at workstation(s)") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("Login at workstation(s)") . ":",0,0,"R",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,$account->smb_smbuserworkstations,0,1,"L",0);
|
$pdfFile->Cell(50,5,$account->smb_smbuserworkstations,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Cell(50,5,_("Windows home directory") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,_("Windows home directory") . ":",0,0,"R",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
|
||||||
$pdfFile->Cell(50,5,$account->smb_home,0,1,"L",0);
|
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Cell(50,5,_("Windows Domain") . ":",0,0,"R",0);
|
$pdfFile->Cell(50,5,$account->smb_home,0,1,"L",0);
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Cell(50,5,_("Windows Domain") . ":",0,0,"R",0);
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
if($_SESSION['config']->get_samba3() == "yes") {
|
if($_SESSION['config']->get_samba3() == "yes") {
|
||||||
$account->smb_domain = $account->smb_domain->name;
|
$account->smb_domain = $account->smb_domain->name;
|
||||||
}
|
}
|
||||||
|
@ -213,9 +212,9 @@ function createUserPDF($accounts) {
|
||||||
$pdfFile->setFont("arial","B",12);
|
$pdfFile->setFont("arial","B",12);
|
||||||
$pdfFile->Write(5,"- " . _("Quota Settings") . ":");
|
$pdfFile->Write(5,"- " . _("Quota Settings") . ":");
|
||||||
$pdfFile->Ln(6);
|
$pdfFile->Ln(6);
|
||||||
$pdfFile->setFont("times","",10);
|
|
||||||
$pdfFile->Cell(50,5,_("User quota(s)") . ":",0,0,"R",0);
|
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Cell(50,5,_("User quota(s)") . ":",0,0,"R",0);
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
$quotas = $account->quota;
|
$quotas = $account->quota;
|
||||||
if(count($quotas)>0) {
|
if(count($quotas)>0) {
|
||||||
$pdfFile->Cell(30,5,_("Mountpoint"),0,0,"L",0);
|
$pdfFile->Cell(30,5,_("Mountpoint"),0,0,"L",0);
|
||||||
|
@ -236,16 +235,13 @@ function createUserPDF($accounts) {
|
||||||
$pdfFile->Cell(50,5,_("No user quotas defined or no quota support by filesystem."),0,1,"L",0);
|
$pdfFile->Cell(50,5,_("No user quotas defined or no quota support by filesystem."),0,1,"L",0);
|
||||||
}
|
}
|
||||||
$pdfFile->Ln(9);
|
$pdfFile->Ln(9);
|
||||||
$pdfFile->setFont("arial","B",12);
|
|
||||||
}
|
}
|
||||||
// Close document and send it to the browser
|
|
||||||
// $pdfFile->Close();
|
|
||||||
// $pdfFile->Output();
|
|
||||||
|
|
||||||
|
// Close PDF
|
||||||
|
$pdfFile->Close();
|
||||||
|
|
||||||
// Delete old PDF older than 3 min
|
// Delete old PDF older than 3 min
|
||||||
$relpath = $_SESSION['lampath'].'tmp/';
|
$relpath = $_SESSION['lampath'].'tmp/';
|
||||||
|
|
||||||
$t=time();
|
$t=time();
|
||||||
$h=opendir("$relpath");
|
$h=opendir("$relpath");
|
||||||
while ($file=readdir($h)) {
|
while ($file=readdir($h)) {
|
||||||
|
@ -258,18 +254,14 @@ function createUserPDF($accounts) {
|
||||||
}
|
}
|
||||||
closedir($h);
|
closedir($h);
|
||||||
|
|
||||||
// Close PDF
|
// use timestamp and random number from ldap.inc as filename so it should be unique.
|
||||||
$pdfFile->Close();
|
|
||||||
// use timestamp as filename so it should be unique.
|
|
||||||
$time = time();
|
$time = time();
|
||||||
$filename = $relpath. $time .'.pdf';
|
$filename = $relpath . $_SESSION['ldap']->rand . $time .'.pdf';
|
||||||
$fileurl = $_SESSION['lamurl'].'templates/getpdf.php?&f='.$_SESSION['lampath'] .'tmp/'. $time .'.pdf';
|
$fileurl = $_SESSION['lamurl'] . 'templates/getpdf.php?&f=' . $_SESSION['lampath'] . 'tmp/' . $_SESSION['ldap']->rand . $time .'.pdf';
|
||||||
// Save PDF
|
// Save PDF
|
||||||
$pdfFile->Output($filename);
|
$pdfFile->Output($filename);
|
||||||
|
|
||||||
// Create redirector page
|
// Create redirector page
|
||||||
|
|
||||||
|
|
||||||
echo $_SESSION['header'];
|
echo $_SESSION['header'];
|
||||||
echo "<html><head><title>";
|
echo "<html><head><title>";
|
||||||
echo _("PDF File");
|
echo _("PDF File");
|
||||||
|
@ -308,24 +300,24 @@ function createHostPDF($accounts) {
|
||||||
$pdfFile->setFont("times","B",16);
|
$pdfFile->setFont("times","B",16);
|
||||||
$pdfFile->Write(5,$account->general_username);
|
$pdfFile->Write(5,$account->general_username);
|
||||||
$pdfFile->Ln(8);
|
$pdfFile->Ln(8);
|
||||||
$pdfFile->setFont("times","",10);
|
|
||||||
$pdfFile->Write(5,_("Description") . ": ");
|
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Write(5,_("Description") . ": ");
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Write(5,$account->general_gecos);
|
$pdfFile->Write(5,$account->general_gecos);
|
||||||
$pdfFile->Ln(5);
|
$pdfFile->Ln(5);
|
||||||
$pdfFile->setFont("times","",10);
|
|
||||||
$pdfFile->Write(5,_("UID") . ": ");
|
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Write(5,_("UID") . ": ");
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Write(5,$account->general_uidNumber);
|
$pdfFile->Write(5,$account->general_uidNumber);
|
||||||
$pdfFile->Ln(5);
|
$pdfFile->Ln(5);
|
||||||
$pdfFile->setFont("times","",10);
|
|
||||||
$pdfFile->Write(5,_("Primary group") . ": ");
|
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Write(5,_("Primary group") . ": ");
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Write(5,$account->general_group);
|
$pdfFile->Write(5,$account->general_group);
|
||||||
$pdfFile->Ln(5);
|
$pdfFile->Ln(5);
|
||||||
$pdfFile->setFont("times","",10);
|
|
||||||
$pdfFile->Write(5,_("Domain") . ": ");
|
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Write(5,_("Domain") . ": ");
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
unset($domain);
|
unset($domain);
|
||||||
if (is_string($account->smb_domain)) {
|
if (is_string($account->smb_domain)) {
|
||||||
$domain = $account->smb_domain;
|
$domain = $account->smb_domain;
|
||||||
|
@ -335,9 +327,9 @@ function createHostPDF($accounts) {
|
||||||
}
|
}
|
||||||
$pdfFile->Write(5,$domain);
|
$pdfFile->Write(5,$domain);
|
||||||
$pdfFile->Ln(5);
|
$pdfFile->Ln(5);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Write(5,_("DN") . ": ");
|
$pdfFile->Write(5,_("DN") . ": ");
|
||||||
$pdfFile->setFont("times","B",9);
|
$pdfFile->setFont("times","",9);
|
||||||
$pdfFile->Write(5,$account->general_dn);
|
$pdfFile->Write(5,$account->general_dn);
|
||||||
// print second column
|
// print second column
|
||||||
if ($accounts[$i+1]) {
|
if ($accounts[$i+1]) {
|
||||||
|
@ -350,27 +342,27 @@ function createHostPDF($accounts) {
|
||||||
$pdfFile->Write(5,$account->general_username);
|
$pdfFile->Write(5,$account->general_username);
|
||||||
$pdfFile->Ln(7);
|
$pdfFile->Ln(7);
|
||||||
$pdfFile->SetX(115);
|
$pdfFile->SetX(115);
|
||||||
$pdfFile->setFont("times","",10);
|
|
||||||
$pdfFile->Write(5,_("Description") . ": ");
|
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Write(5,_("Description") . ": ");
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Write(5,$account->general_gecos);
|
$pdfFile->Write(5,$account->general_gecos);
|
||||||
$pdfFile->Ln(5);
|
$pdfFile->Ln(5);
|
||||||
$pdfFile->SetX(115);
|
$pdfFile->SetX(115);
|
||||||
$pdfFile->setFont("times","",10);
|
|
||||||
$pdfFile->Write(5,_("UID") . ": ");
|
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Write(5,_("UID") . ": ");
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Write(5,$account->general_uidNumber);
|
$pdfFile->Write(5,$account->general_uidNumber);
|
||||||
$pdfFile->Ln(5);
|
$pdfFile->Ln(5);
|
||||||
$pdfFile->SetX(115);
|
$pdfFile->SetX(115);
|
||||||
$pdfFile->setFont("times","",10);
|
|
||||||
$pdfFile->Write(5,_("Primary group") . ": ");
|
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Write(5,_("Primary group") . ": ");
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
$pdfFile->Write(5,$account->general_group);
|
$pdfFile->Write(5,$account->general_group);
|
||||||
$pdfFile->Ln(5);
|
$pdfFile->Ln(5);
|
||||||
$pdfFile->SetX(115);
|
$pdfFile->SetX(115);
|
||||||
$pdfFile->setFont("times","",10);
|
|
||||||
$pdfFile->Write(5,_("Domain") . ": ");
|
|
||||||
$pdfFile->setFont("times","B",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Write(5,_("Domain") . ": ");
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
unset($domain);
|
unset($domain);
|
||||||
if (is_string($account->smb_domain)) {
|
if (is_string($account->smb_domain)) {
|
||||||
$domain = $account->smb_domain;
|
$domain = $account->smb_domain;
|
||||||
|
@ -381,9 +373,9 @@ function createHostPDF($accounts) {
|
||||||
$pdfFile->Write(5,$domain);
|
$pdfFile->Write(5,$domain);
|
||||||
$pdfFile->Ln(5);
|
$pdfFile->Ln(5);
|
||||||
$pdfFile->SetX(115);
|
$pdfFile->SetX(115);
|
||||||
$pdfFile->setFont("times","",10);
|
$pdfFile->setFont("times","B",10);
|
||||||
$pdfFile->Write(5,_("DN") . ": ");
|
$pdfFile->Write(5,_("DN") . ": ");
|
||||||
$pdfFile->setFont("times","B",9);
|
$pdfFile->setFont("times","",9);
|
||||||
$pdfFile->Write(5,$account->general_dn);
|
$pdfFile->Write(5,$account->general_dn);
|
||||||
}
|
}
|
||||||
// space between two rows
|
// space between two rows
|
||||||
|
@ -414,15 +406,14 @@ function createHostPDF($accounts) {
|
||||||
}
|
}
|
||||||
closedir($h);
|
closedir($h);
|
||||||
|
|
||||||
// use timestamp as filename so it should be unique.
|
// use timestamp and random number from ldap.inc as filename so it should be unique.
|
||||||
$time = time();
|
$time = time();
|
||||||
$filename = $relpath. $time .'.pdf';
|
$filename = $relpath . $_SESSION['ldap']->rand . $time . '.pdf';
|
||||||
$fileurl = $_SESSION['lamurl'].'templates/getpdf.php?&f='.$_SESSION['lampath'] .'tmp/'. $time .'.pdf';
|
$fileurl = $_SESSION['lamurl'] . 'templates/getpdf.php?&f=' . $_SESSION['lampath'] . 'tmp/'. $_SESSION['ldap']->rand . $time .'.pdf';
|
||||||
// Save PDF
|
// Save PDF
|
||||||
$pdfFile->Output($filename);
|
$pdfFile->Output($filename);
|
||||||
|
|
||||||
// Create redirector page
|
// Create redirector page
|
||||||
|
|
||||||
echo $_SESSION['header'];
|
echo $_SESSION['header'];
|
||||||
echo "<html><head><title>";
|
echo "<html><head><title>";
|
||||||
echo _("PDF File");
|
echo _("PDF File");
|
||||||
|
@ -439,6 +430,111 @@ function createHostPDF($accounts) {
|
||||||
return 0; // 0 means everything successful; page(s) printed
|
return 0; // 0 means everything successful; page(s) printed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// creates a PDF with groups
|
||||||
|
// $accounts: array of account
|
||||||
|
function createGroupPDF($accounts) {
|
||||||
|
// Start PDF file
|
||||||
|
$pdfFile = new lamHostPDF();
|
||||||
|
$pdfFile->Open();
|
||||||
|
// Write some information into the PDF file
|
||||||
|
$pdfFile->setFont("arial","",12);
|
||||||
|
$pdfFile->setTitle("LDAP Account Manager");
|
||||||
|
$pdfFile->setSubject(_("Samba-Host information page"));
|
||||||
|
$pdfFile->setAuthor("LDAP Account Manager Devel-Team -Roland Gruber-");
|
||||||
|
$pdfFile->setCreator("LDAP Account Manager (pdf.inc)");
|
||||||
|
// print host accounts
|
||||||
|
$pdfFile->addPage();
|
||||||
|
for($i = 0; $i < count($accounts); $i++) {
|
||||||
|
$account = $accounts[$i];
|
||||||
|
$ypos = $pdfFile->GetY();
|
||||||
|
$pdfFile->setFont("times","B",16);
|
||||||
|
$pdfFile->Write(5,$account->general_username);
|
||||||
|
$pdfFile->Ln(8);
|
||||||
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Write(5,_("Description") . ": ");
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
|
$pdfFile->Write(5,$account->general_gecos);
|
||||||
|
$pdfFile->Ln(5);
|
||||||
|
if ($account->smb_displayname) {
|
||||||
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Write(5,_("Display name") . ": ");
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
|
$pdfFile->Write(5,$account->smb_displayname);
|
||||||
|
$pdfFile->Ln(5);
|
||||||
|
}
|
||||||
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Write(5,_("GID") . ": ");
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
|
$pdfFile->Write(5,$account->general_uidNumber);
|
||||||
|
$pdfFile->Ln(5);
|
||||||
|
if ($account->domain) {
|
||||||
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Write(5,_("Domain") . ": ");
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
|
$pdfFile->Write(5,$account->domain->name);
|
||||||
|
$pdfFile->Ln(5);
|
||||||
|
}
|
||||||
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Write(5,_("DN") . ": ");
|
||||||
|
$pdfFile->setFont("times","",9);
|
||||||
|
$pdfFile->Write(5,$account->general_dn);
|
||||||
|
if (is_array($account->unix_memberUid)) {
|
||||||
|
$pdfFile->Ln(5);
|
||||||
|
$pdfFile->setFont("times","B",10);
|
||||||
|
$pdfFile->Write(5,_("Members") . ": ");
|
||||||
|
$pdfFile->setFont("times","",10);
|
||||||
|
$pdfFile->Write(5,implode(", ", $account->unix_memberUid));
|
||||||
|
}
|
||||||
|
|
||||||
|
// space between two rows
|
||||||
|
if ($i < count($accounts) - 1) {
|
||||||
|
$pdfFile->Ln(12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close PDF
|
||||||
|
$pdfFile->Close();
|
||||||
|
|
||||||
|
// Delete old PDF older than 3 min
|
||||||
|
$relpath = $_SESSION['lampath'].'tmp/';
|
||||||
|
|
||||||
|
$t=time();
|
||||||
|
$h=opendir("$relpath");
|
||||||
|
while ($file=readdir($h)) {
|
||||||
|
if (substr($file, -4)=='.pdf') {
|
||||||
|
$path = $relpath.$file;
|
||||||
|
if ($t-filemtime($path)>180)
|
||||||
|
@unlink($path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($h);
|
||||||
|
|
||||||
|
// use timestamp and random number from ldap.inc as filename so it should be unique.
|
||||||
|
$time = time();
|
||||||
|
$filename = $relpath . $_SESSION['ldap']->rand . $time . '.pdf';
|
||||||
|
$fileurl = $_SESSION['lamurl'] . 'templates/getpdf.php?&f=' . $_SESSION['lampath'] . 'tmp/'. $_SESSION['ldap']->rand . $time .'.pdf';
|
||||||
|
|
||||||
|
// Save PDF
|
||||||
|
$pdfFile->Output($filename);
|
||||||
|
|
||||||
|
// Create redirector page
|
||||||
|
echo $_SESSION['header'];
|
||||||
|
echo "<html><head><title>";
|
||||||
|
echo _("PDF File");
|
||||||
|
echo "</title>\n".
|
||||||
|
"<link rel=\"stylesheet\" type=\"text/css\" href=\"".$_SESSION['lamurl']."style/layout.css\">\n".
|
||||||
|
"<meta http-equiv=\"pragma\" content=\"no-cache\">\n".
|
||||||
|
"<meta http-equiv=\"cache-control\" content=\"no-cache\">\n".
|
||||||
|
"<meta http-equiv=\"refresh\" content=\"2; URL=$fileurl\">\n".
|
||||||
|
"</head><body>\n".
|
||||||
|
"<a href=\"$fileurl\">";
|
||||||
|
echo _('Please press here if meta-refresh didn\'t work.');
|
||||||
|
echo "</a></body></html>";
|
||||||
|
|
||||||
|
return 0; // 0 means everything successful; page(s) printed
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// lamPDF class || For defining own a Header and Footer
|
// lamPDF class || For defining own a Header and Footer
|
||||||
class lamPDF extends FPDF {
|
class lamPDF extends FPDF {
|
||||||
// Print page header
|
// Print page header
|
||||||
|
@ -449,7 +545,7 @@ class lamPDF extends FPDF {
|
||||||
$this->Cell(170,5,"LDAP Account Manager",0,1,"R",0);
|
$this->Cell(170,5,"LDAP Account Manager",0,1,"R",0);
|
||||||
$this->Ln(3);
|
$this->Ln(3);
|
||||||
$this->SetFont("times","",14);
|
$this->SetFont("times","",14);
|
||||||
$this->Cell(170,5,"-" . _("User information page") . "-",0,0,"R",0);
|
$this->Cell(170,5,"- " . _("User information page") . " -",0,0,"R",0);
|
||||||
$this->SetLineWidth(0.8);
|
$this->SetLineWidth(0.8);
|
||||||
$this->Line(10,40,200,40);
|
$this->Line(10,40,200,40);
|
||||||
$this->Line(10,42,200,42);
|
$this->Line(10,42,200,42);
|
||||||
|
@ -466,6 +562,7 @@ class lamPDF extends FPDF {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// lamHostPDF class || For defining own a Header and Footer
|
// lamHostPDF class || For defining own a Header and Footer
|
||||||
class lamHostPDF extends FPDF {
|
class lamHostPDF extends FPDF {
|
||||||
// Print page header
|
// Print page header
|
||||||
|
@ -476,7 +573,7 @@ class lamHostPDF extends FPDF {
|
||||||
$this->Cell(170,5,"LDAP Account Manager",0,1,"R",0);
|
$this->Cell(170,5,"LDAP Account Manager",0,1,"R",0);
|
||||||
$this->Ln(3);
|
$this->Ln(3);
|
||||||
$this->SetFont("times","",14);
|
$this->SetFont("times","",14);
|
||||||
$this->Cell(170,5,"-" . _("Samba-Host information page") . "-",0,0,"R",0);
|
$this->Cell(170,5,"- " . _("Samba-Host information page") . " -",0,0,"R",0);
|
||||||
$this->SetLineWidth(0.8);
|
$this->SetLineWidth(0.8);
|
||||||
$this->Line(10,35,200,35);
|
$this->Line(10,35,200,35);
|
||||||
$this->Line(10,37,200,37);
|
$this->Line(10,37,200,37);
|
||||||
|
@ -495,3 +592,35 @@ class lamHostPDF extends FPDF {
|
||||||
$this->Cell(0,5,$this->PageNo(),0,1,"R",0);
|
$this->Cell(0,5,$this->PageNo(),0,1,"R",0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// lamGroupPDF class || For defining own Header and Footer
|
||||||
|
class lamGroupPDF extends FPDF {
|
||||||
|
// Print page header
|
||||||
|
function header() {
|
||||||
|
$imageFile = substr(__FILE__,0,strlen(__FILE__)- 11) . "graphics/printLogo.jpg";
|
||||||
|
$this->Image($imageFile,10,10,50,20,"JPG");
|
||||||
|
$this->SetFont("arial","B",22);
|
||||||
|
$this->Cell(170,5,"LDAP Account Manager",0,1,"R",0);
|
||||||
|
$this->Ln(3);
|
||||||
|
$this->SetFont("times","",14);
|
||||||
|
$this->Cell(170,5,"- " . _("Group information page") . " -",0,0,"R",0);
|
||||||
|
$this->SetLineWidth(0.8);
|
||||||
|
$this->Line(10,35,200,35);
|
||||||
|
$this->Line(10,37,200,37);
|
||||||
|
$this->SetY(45);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print page footer
|
||||||
|
function footer() {
|
||||||
|
$this->SetLineWidth(0.8);
|
||||||
|
$this->Line(10,280,200,280);
|
||||||
|
$this->Line(10,282,200,282);
|
||||||
|
$this->SetY(285);
|
||||||
|
$this->SetFont("arial","B",12);
|
||||||
|
$this->Cell(0,5,_("This document was automatically created by LDAP Account Manager"),0,0,"C",0);
|
||||||
|
$this->SetFont("arial","",12);
|
||||||
|
$this->Cell(0,5,$this->PageNo(),0,1,"R",0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue