Exemplo n.º 1
0
function GetContacts($username, $password)
{
    if (authentication($username, $password)) {
        global $adb;
        global $log;
        require_once 'modules/Contacts/Contacts.php';
        $seed_contact = new Contacts();
        $output_list = array();
        $query = $seed_contact->get_contactsforol($username);
        $result = $adb->pquery($query, array());
        while ($contact = $adb->fetch_array($result)) {
            if ($contact["birthdate"] == "0000-00-00") {
                $contact["birthdate"] = "";
            }
            if ($contact["salutation"] == "--None--") {
                $contact["salutation"] = "";
            }
            $output_list[] = array("id" => decode_html($contact["id"]), "title" => decode_html($contact["salutation"]), "firstname" => decode_html($contact["firstname"]), "middlename" => decode_html(trim($middlename)), "lastname" => decode_html(trim($contact["lastname"])), "birthdate" => $contact["birthday"], "emailaddress" => decode_html($contact["email"]), "jobtitle" => decode_html($contact["title"]), "department" => decode_html($contact["department"]), "accountname" => decode_html($contact["accountname"]), "officephone" => decode_html($contact["phone"]), "homephone" => decode_html($contact["homephone"]), "otherphone" => decode_html($contact["otherphone"]), "fax" => decode_html($contact["fax"]), "mobile" => decode_html($contact["mobile"]), "asstname" => decode_html($contact["assistant"]), "asstphone" => decode_html($contact["assistantphone"]), "reportsto" => decode_html($contact["reports_to_name"]), "mailingstreet" => decode_html($contact["mailingstreet"]), "mailingcity" => decode_html($contact["mailingcity"]), "mailingstate" => decode_html($contact["mailingstate"]), "mailingzip" => decode_html($contact["mailingzip"]), "mailingcountry" => decode_html($contact["mailingcountry"]), "otherstreet" => decode_html($contact["otherstreet"]), "othercity" => decode_html($contact["othercity"]), "otherstate" => decode_html($contact["otherstate"]), "otherzip" => decode_html($contact["otherzip"]), "othercountry" => decode_html($contact["othercountry"]), "description" => "", "category" => "");
        }
        //to remove an erroneous compiler warning
        $seed_contact = $seed_contact;
        return $output_list;
    }
}
Exemplo n.º 2
0
function GetContacts($username, $session)
{
    if (!validateSession($username, $session)) {
        return null;
    }
    global $adb;
    require_once 'modules/Contacts/Contacts.php';
    $seed_contact = new Contacts();
    $output_list = array();
    $query = $seed_contact->get_contactsforol($username);
    $result = $adb->query($query);
    $outputcount = 0;
    $outputxml = '';
    /** we are directly returning XML */
    $returnAsXML = true;
    while ($contact = $adb->fetch_array($result)) {
        if ($contact["birthdate"] == "0000-00-00") {
            $contact["birthdate"] = "";
        }
        if ($contact["salutation"] == "--None--") {
            $contact["salutation"] = "";
        }
        $namelist = explode(" ", $contact["lastname"]);
        $middlename = "";
        if (isset($namelist)) {
            if (count($namelist) >= 2) {
                $contact["lastname"] = $namelist[count($namelist) - 1];
                for ($i = 0; $i < count($namelist) - 2; $i++) {
                    if ($namelist[$i] != '') {
                        $middlename[] = $namelist[$i];
                    }
                }
                if (isset($middlename)) {
                    $middlename = implode(" ", $middlename);
                }
            }
        }
        $outputxml .= __GetContactSOAPNode($contact);
        $outputcount++;
    }
    //to remove an erroneous compiler warning
    $seed_contact = $seed_contact;
    global $server;
    $server->methodreturnisliteralxml = true;
    $output = "<return xsi:type='SOAP-ENC:Array' SOAP-ENC:arrayType='tns:contactdetail[{$outputcount}]'>{$outputxml}</return>";
    return $output;
}