summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 67f6e5c)
raw | patch | inline | side by side (parent: 67f6e5c)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 30 Nov 2006 06:29:41 +0000 (06:29 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 30 Nov 2006 06:29:41 +0000 (06:29 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5256 594d385d-05f5-0310-b6e9-bd551577e9d8
include/functions.inc | patch | blob | history |
diff --git a/include/functions.inc b/include/functions.inc
index dcc5a73ac1951974d6ef4ad65d151ba8d5dc5840..1e0bafeb17985454101ae9b14774b29e242a40a9 100644 (file)
--- a/include/functions.inc
+++ b/include/functions.inc
function get_printer_list($cups_server)
{
global $config;
-
- $res= array();
-
- /* Use CUPS, if we've access to it */
- if (function_exists('cups_get_dest_list')){
- $dest_list= cups_get_dest_list ($cups_server);
-
- foreach ($dest_list as $prt){
- $attr= cups_get_printer_attributes ($cups_server, $prt->name);
-
- foreach ($attr as $prt_info){
- if ($prt_info->name == "printer-info"){
- $info= $prt_info->value;
- break;
- }
- }
- $res[$prt->name]= "$info [$prt->name]";
- }
-
- /* CUPS is not available, try lpstat as a replacement */
- } else {
- $ar = false;
- exec("lpstat -p", $ar);
- foreach($ar as $val){
- @list($dummy, $printer, $rest)= split(' ', $val, 3);
- if (preg_match('/^[^@]+$/', $printer)){
- $res[$printer]= "$printer";
- }
- }
- }
+ $res = array();
/* Merge in printers from LDAP */
$ldap= $config->get_ldap_link();
$ldap->cd ($config->current['BASE']);
$ldap->search('(objectClass=gotoPrinter)', array('cn'));
+ while($attrs = $ldap->fetch()){
+ $res[$attrs['cn'][0]] = $attrs['cn'][0];
+ }
return $res;
}