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; }
$ret = $gi->get_user_data($testId); $ret = implode(',', $ret['badges']); checkstrmatch(lineno(), $ret, $badgeId1); checkerr(lineno(), $ui_bad->award_badge("user_no_exist", $badgeId1), True); checkerr(lineno(), $ui_bad->award_badge("no", $badgeId1, "best comment"), True); checkerr(lineno(), $gi->award_badge("nouser", "bad-badge"), True); checkerr(lineno(), $gi->award_badge("nouser", "bad-badge-holler"), True); checkerr(lineno(), $gi->award_badge("", $testId), True); checkerr(lineno(), $gi->award_badge("", $testId, "Sharing is Caring"), True); checkerr(lineno(), $gi->award_badge($testId, $badgeId3, "Sharing is Caring"), True); checkerr(lineno(), $gi->award_badge_points($testId, $badgeId2, 10, 100, "Promoter"), True); checknotstr(lineno(), $gi->get_user_data($testId), $badgeId2); checkerr(lineno(), $gi->award_badge_points($testId, $badgeId2, 90, 100, "Promoter"), True); $ret = $gi->get_user_data($testId); $ret = implode(',', $ret['badges']); checkstr(lineno(), $ret, $badgeId2); checkerr(lineno(), $ui_bad->remove_badge("user_no_exist", $badgeId1), True); checkerr(lineno(), $gi->remove_badge("user_no_exist", $badgeId1 . "x"), True); checkerr(lineno(), $gi->remove_badge($testId, $badgeId1 + "x"), True); checkerr(lineno(), $ui_bad->remove_badge("user_no_exist", $badgeId1 . "x"), True); checkerr(lineno(), $gi->remove_badge($testId, $badgeId1), True); checknotstr(lineno(), $gi->get_user_data($testId), $badgeId1); checkerr(lineno(), $ui_bad->award_points($testId, 10, "Shared with a friend"), True); checkerr(lineno(), $gi->award_points($testId, "hello", "Shared with a friend"), True); checkerr(lineno(), $gi->award_points($testId, 10, "Shared with a friend"), True); if ($cleanup) { $ret = __sync_url_post($delete_path, $argsdict); checkstr(lineno(), $ret, "success"); } print "Success!\n"; exit(0);