예제 #1
0
     $xml_output = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
     $xml_output .= "<phonebooks>\n";
     $xml_output .= "<phonebook>\n";
     for ($i = 0; $i < $info["count"]; $i++) {
         $xml_output .= "\t<contact>\n";
         $xml_output .= "\t\t<category>0</category>\n";
         $xml_output .= "\t\t<person><realName>" . $info[$i]["givenname"][0] . " " . $info[$i]["sn"][0] . "</realName></person>\n";
         $xml_output .= "\t\t<telephony>\n";
         if ($info[$i]["homephone"][0]) {
             $xml_output .= "\t\t\t<number type=\"home\" vanity=\"\" prio=\"0\">" . noLocalCountryCode($info[$i]["homephone"][0], $localCountryCode) . "</number>\n";
         }
         if ($info[$i]["telephonenumber"][0]) {
             $xml_output .= "\t\t\t<number type=\"work\" vanity=\"\" prio=\"0\">" . noLocalCountryCode($info[$i]["telephonenumber"][0], $localCountryCode) . "</number>\n";
         }
         if ($info[$i]["mobile"][0]) {
             $xml_output .= "\t\t\t<number type=\"mobile\" vanity=\"\" prio=\"0\">" . noLocalCountryCode($info[$i]["mobile"][0], $localCountryCode) . "</number>\n";
         }
         $xml_output .= "\t\t</telephony>\n";
         $xml_output .= "\t\t<services />\n";
         $xml_output .= "\t\t<setup />\n";
         $xml_output .= "\t\t<uniqueid>" . $i . "</uniqueid>\n";
         $xml_output .= "\t</contact>\n";
     }
     ldap_close($ds);
     $xml_output .= "</phonebook>";
     $xml_output .= "</phonebooks>";
     $fp = fopen('gs_phonebook-dyn.xml', 'wb');
     fwrite($fp, $xml_output);
     fclose($fp);
     print $xml_output;
 }
예제 #2
0
            if ($info[$i]["telephonenumber"][0]) {
                // if work phone number is set, add a new entry in the xml file with a trailing [W] in the first name
                $xml_output .= "\t<Contact>\n";
                $xml_output .= "\t\t<LastName>" . $info[$i]["sn"][0] . "</LastName>\n";
                $xml_output .= "\t\t<FirstName>" . $info[$i]["givenname"][0] . $workPhoneSuffix . "</FirstName>\n";
                $xml_output .= "\t\t\t<Phone>\n\t\t\t\t<phonenumber>" . noLocalCountryCode($info[$i]["telephonenumber"][0], $localCountryCode) . "</phonenumber>\n";
                $xml_output .= "\t\t\t\t<accountindex>" . $accountIndex . "</accountindex>\n";
                $xml_output .= "\t\t\t</Phone>\n";
                $xml_output .= "\t</Contact>\n";
            }
            if ($info[$i]["mobile"][0]) {
                // if mobile phone is set, add a new entry in the xml file with a trailing [M] in the first name
                $xml_output .= "\t<Contact>\n";
                $xml_output .= "\t\t<LastName>" . $info[$i]["sn"][0] . "</LastName>\n";
                $xml_output .= "\t\t<FirstName>" . $info[$i]["givenname"][0] . $mobilePhoneSuffix . "</FirstName>\n";
                $xml_output .= "\t\t\t<Phone>\n\t\t\t\t<phonenumber>" . noLocalCountryCode($info[$i]["mobile"][0], $localCountryCode) . "</phonenumber>\n";
                $xml_output .= "\t\t\t\t<accountindex>" . $accountIndex . "</accountindex>\n";
                $xml_output .= "\t\t\t</Phone>\n";
                $xml_output .= "\t</Contact>\n";
            }
        }
        ldap_close($ds);
        $xml_output .= "</AddressBook>";
        $fp = fopen('gs_phonebook-dyn.xml', 'wb');
        fwrite($fp, $xml_output);
        fclose($fp);
        print $xml_output;
    }
}
/* 
Incoming national calls do not have the country code prefixed on the GXP