Example #1
0
function prepare_message_review($dbh, $req_id)
{
    $_SESSION['requestid'] = $req_id;
    /* In order to display the message review screen, we need to first get the request record.  Then the
     * account ID is used to log into the Bronto API to extract other message-oriented information.
     */
    $reqinfo = db_load_request($dbh, $req_id);
    if ($reqinfo != null) {
        $acctid = $reqinfo['account_id'];
        $login_info = bronto_agency_login($acctid);
        if ($login_info) {
            $bapi = $login_info['binding'];
            $session_id = $login_info['sessionID'];
            $_SESSION['session_id'] = $session_id;
            $username = $_SESSION['username'];
            $rc = db_save_session($dbh, $session_id, $username, $acctid);
            if ($rc == false) {
                display_warnbox("Unable to save session information (id=" . $session_id . ",user="******")");
            }
            print_message_review_form($bapi, $session_id, $reqinfo);
            if (db_update_request_status($dbh, $req_id, "UNDER_REVIEW") == false) {
                display_warnbox("Unable to update request status.");
            }
        } else {
            display_errorbox("Unable to contact the Bronto API server.");
            print_requestid_form($req_id);
        }
    } else {
        display_errorbox("Request ID " . $req_id . " is invalid.");
        print_requestid_form($req_id);
    }
}
Example #2
0
echo "<bronto-data>\n";
$login_result = bronto_agency_login();
if (!$login_result) {
    die("Unable to log in to agency account");
}
$binding = $login_result['binding'];
$accounts = get_all_accounts($binding);
if ($accounts == null) {
    die("Unable to get accounts");
}
echo "<accounts count=\"" . count($accounts) . "\">\n";
$acct_num = 0;
foreach ($accounts as $acct) {
    echo "<account id=\"" . $acct->id . "\" name=\"" . $acct->name . "\" currContactCount=\"" . $acct->currContactCount . "\" " . "maxContactCount=\"" . $acct->maxContactCount . "\" monthEmailCount=\"" . $acct->monthEmailCount . "\" " . "currHostingSize=\"" . $acct->currHostingSize . "\" maxHostingSize=\"" . $acct->maxHostingSize . "\">\n";
    // Now login to the subaccount using the agency account, but specifying the subaccount ID in the login.
    $login_result = bronto_agency_login($acct->id);
    if (!$login_result) {
        echo "<error text=\"INVALID ACCOUNT\"/>\n";
    } else {
        $binding = $login_result['binding'];
        if ($disp_lists) {
            display_lists($binding);
        }
        if ($disp_fields) {
            display_fields($binding);
        }
        if ($disp_contacts) {
            display_contacts($binding, $disp_contact_fields);
        }
        if ($disp_messages) {
            display_messages($binding);
Example #3
0
}
echo "Retrieving fields for source account id={$src_acct}\n";
$src_fields = get_all_fields($binding);
echo "Got " . count($src_fields) . " fields for this account\n";
// Create extra arrays to index the fields by fieldID and fieldName
$src_field_ids = array();
$src_field_names = array();
foreach ($src_fields as $fld) {
    $src_field_ids[$fld->id] = $fld;
    $src_field_names[$fld->name] = $fld;
}
echo "Retrieving contacts for list id={$src_list}\n";
$contacts = get_contacts_using_listids($binding, $src_list);
print_r($contacts);
echo "Ready to migrate " . count($contacts) . " contacts from acct:list = {$src_acct}:{$src_list}\n";
$login_result = bronto_agency_login($dest_acct);
if (!$login_result) {
    echo "Error: Unable to login to destination account id={$dest_acct}\n";
    exit(1);
}
$binding = $login_result['binding'];
if (!$use_ids) {
    $lists = get_lists_using_names($binding, $dest_list);
    if (!$lists) {
        echo "Error: Unable to map destination list name [{$dest_list}] to list ID\n";
        exit(1);
    } else {
        if (count($lists) > 1) {
            echo "Error: More than one list matched destination list name [{$dest_list}]\n";
            exit(1);
        }
Example #4
0
<?php

require_once '../include/common.inc.php';
echo "Starting...\n";
$login_result = bronto_agency_login();
$binding = $login_result['binding'];
$accounts = get_all_accounts($binding);
if ($accounts == null) {
    die("Unable to get accounts");
}
foreach ($accounts as $acct) {
    echo $acct->id . "," . $acct->name . "\n";
}