function process_request($request)
 {
     // perform userinfuser registration
     $ui = new UserInfuser("*****@*****.**", "0658a511-d890-4e51-ba9e-126d6c0a12f2");
     $ui->update_user(qa_get_logged_in_email(), qa_get_logged_in_userid(), "", "");
     $ui->award_points(qa_get_logged_in_email(), 1000);
     $pw = $ui->get_widget(qa_get_logged_in_email(), "points", 100, 100);
     $lw = $ui->get_widget(qa_get_logged_in_email(), "leaderboard", 600, 300);
     $qa_content = qa_content_prepare();
     $qa_content['title'] = 'Example plugin page';
     $qa_content['error'] = 'An example error';
     $qa_content['custom'] = 'Some <B>custom html</B>';
     $qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'wide', 'ok' => qa_post_text('okthen') ? 'You clicked OK then!' : null, 'title' => 'Form title', 'fields' => array('request' => array('label' => 'The request' . qa_get_logged_in_userid(), 'tags' => 'NAME="request"', 'value' => qa_html($request), 'error' => qa_html('Another error'))), 'buttons' => array('ok' => array('tags' => 'NAME="okthen"', 'label' => 'OK then', 'value' => '1')), 'hidden' => array('hiddenfield' => '1'));
     $qa_content['custom_2'] = '<P><BR>More <I>custom html</I></P>';
     $qa_content['custom_3'] = $pw . $lw;
     return $qa_content;
 }
Beispiel #2
0
print $gi->get_widget("", "milestones", 400, 200);
$gi = new UserInfuser($account, $apiKey);
$ui_bad = new UserInfuser($account . "x", $apiKey . "x");
$ui_bad->enable_local_testing();
$ui_bad->enable_debug();
$gi->enable_local_testing();
$gi->enable_debug();
$ret = __sync_url_post($prime_path, $argsdict);
checkstr(lineno(), $ret, "success");
$ret = __sync_url_post($delete_path, $argsdict);
checkstr(lineno(), $ret, "success");
$ret = __sync_url_post($prime_path, $argsdict);
checkstr(lineno(), $ret, "success");
checkjson(lineno(), $gi->get_user_data("user_no_exist"), "failed");
# Test with non existing account and api key
checkerr(lineno(), $ui_bad->update_user("user_no_exist"), True);
checkjson(lineno(), $ui_bad->get_user_data("user_no_exist"), "failed");
# Test with bad api key, but good account
checkerr(lineno(), $gi->update_user($testId), True);
checkerr(lineno(), $gi->update_user($testId, "John Smith"), True);
$start = microtime();
checkerr(lineno(), $gi->update_user($testId, "John Smith", 'http://facebook.com/nlake44', "http://profile.ak.fbcdn.net/hprofile-ak-snc4/203059_3610637_6604695_q.jpg"), True);
$async_call_time = microtime() - $start;
if ($sync_call_time < $async_call_time) {
    print "Sync time is greater than async time";
    print "Sync time:" . $sync_call_time;
    print "Async time:" . $async_call_time;
    exit(1);
}
checkjson(lineno(), $gi->get_user_data($testId), "success");
$ret = $gi->get_user_data($testId);