/**
  * createAccount
  *
  * @param string $name account name
  * @param string $password password
  * @return string account id
  */
 function createAccount($name, $password)
 {
     $option_string = '';
     try {
         $soap = '<CreateAccountRequest xmlns="urn:zimbraAccount">
         <name>' . $name . '@' . $this->_server1 . '</name>
         <password>' . $password . '</password>' . $option_string . '
         <session/>
         </CreateAccountRequest>';
         $response = $this->soapRequest($soap);
     } catch (SoapFault $exception) {
         print_exception($exception);
     }
     return $result['SOAP:ENVELOPE']['SOAP:BODY']['CREATEACCOUNTRESPONSE']['ACCOUNT']['ID'];
 }
    $r = $userManager->changeUserPassword($user_name, $userpassword, "newPassword42");
    if (is_a($r, "Exception")) {
        echo "Error : cannot change password for user {$user_name} :-(\n";
        print_exception($r);
    } else {
        print_var($r, "Change User Password");
        echo "OK : password changed for user {$user_name} :-)\n";
    }
}
// Modify Prefs
if ($action == "mup") {
    if (!$nam_opt) {
        $nam_opt = "zimbraPrefMailItemsPerPage";
    }
    if (!$val_opt) {
        $val_opt = "42";
    }
    $new_prefs = array($nam_opt => $val_opt);
    print_var($new_prefs, "Modify Prefs");
    $r = $userManager->modifyUserPrefs($user_name, $new_prefs);
    if (is_a($r, "Exception")) {
        echo "Error : cannot modify prefs for {$user_name} :-(\n";
        print_exception($r);
    } else {
        print_var($r, "Modify Prefs : Response");
        echo "OK : modify user prefs for {$user_name} :-)\n";
    }
}
if (!$r) {
    echo "Invalid action!\n";
}
try {
    $a = new Phar(dirname(__FILE__) . '/files/frontcontroller10.phar');
} catch (PharException $e) {
    print_exception($e);
}
$a->convertToExecutable(array());
$a->convertToData(array());
try {
    $b = new PharData(dirname(__FILE__) . '/whatever.tar');
} catch (PharException $e) {
    print_exception($e);
}
try {
    $c = new PharData(dirname(__FILE__) . '/whatever.zip');
} catch (PharException $e) {
    print_exception($e);
}
$b->delete(array());
try {
    $a->delete('oops');
} catch (Exception $e) {
    echo $e->getMessage() . "\n";
}
try {
    $b->delete('oops');
} catch (Exception $e) {
    echo $e->getMessage() . "\n";
}
echo $a->getPath() . "\n";
try {
    $a->setAlias('oops');
Example #4
0
function send_blast_email($binding, $req_info)
{
    $delivery = create_delivery($req_info);
    $handler = array();
    $handler['mode'] = "insert";
    $params = array("deliveries" => $delivery, "handler" => $handler);
    try {
        $res = $binding->writeDeliveries($params);
        $res = normalize_result($res);
        if (count($res) != 1) {
            echo "Expecting only one result for writeDeliveries(), since we sent only one delivery.";
        }
        $res = $res[0];
        if ($res->success) {
            return true;
        } else {
            print_errors($res->errors);
            return false;
        }
    } catch (SoapFault $ex) {
        print_exception($binding, $ex);
        return false;
    }
}