Beispiel #1
0
function fb_invoke($type, $verb, $args = array())
{
    $type_args = array('list' => array('per_page' => 100));
    $fb = new Freshbooks\FreshBooksApi(FB_DOMAIN, FB_KEY);
    $fb->setMethod("{$type}.{$verb}");
    $fb->post($args + g($type_args, $type, A()));
    $fb->request();
    $type_plural = $type == 'time_entry' ? 'time_entries' : "{$type}s";
    if ($fb->success()) {
        $rs = $fb->getResponse();
        switch ($verb) {
            case 'list':
                $count = hop($rs, $type_plural, '@attributes', 'total');
                switch ($count) {
                    case 0:
                        return A();
                    case 1:
                        return A(hop($rs, $type_plural, $type));
                    default:
                        return hop($rs, $type_plural, $type);
                }
            default:
                return $rs;
        }
    } else {
        trigger_error("Freshbooks: {$method} failure: " . $fb->getError(), E_USER_ERROR);
    }
}
Beispiel #2
0
    }
    for ($i = 1; $i <= $nbdiag; $i++) {
        fwrite($FIC, 'DIAG_' . $i . "\t");
    }
    for ($i = 1; $i <= $nbngap; $i++) {
        fwrite($FIC, 'NGAP_' . $i . "\t");
    }
    fwrite($FIC, "\n");
    print "generation du fic";
    for ($i = 0; $i < $gligne; $i++) {
        set_time_limit(30);
        print "\n ligne {$i} , {$nbreste} colonnes {$nbccam} ccam {$nbdiag} diag {$nbngap} ngap ";
        for ($j = 0; $j < $nbreste; $j++) {
            fwrite($FIC, $export[$i]['global'][$j] . "\t");
        }
        for ($j = 0; $j < $nbccam; $j++) {
            fwrite($FIC, $export[$i]['ccam'][$j] . "\t");
        }
        for ($j = 0; $j < $nbdiag; $j++) {
            fwrite($FIC, $export[$i]['diag'][$j] . "\t");
        }
        for ($j = 0; $j < $nbngap; $j++) {
            fwrite($FIC, $export[$i]['ngap'][$j] . "\t");
        }
        fwrite($FIC, "\n");
    }
    print "\nfin generation du fic\n";
    fclose($FIC);
}
hop();
Beispiel #3
0
<?php

function hop($mailFrom, $mailTo, $subject, $body)
{
    $headers = "Content-Type:text/plain;charset=utf-8\n";
    $headers .= "Content-Transfer-Encoding: 8bit\n";
    $headers .= "From: " . $mailFrom . "\n";
    return mail($mailTo, $subject, $body, $headers);
}
return hop($_POST['mailFrom'], $_POST['mailTo'], $_POST['subject'], $_POST['body']);