public function __construct()
 {
     parent::__construct();
     if ($this->isSandbox()) {
         $this->setSandboxMode();
     }
 }
include_once dirname(__FILE__) . '/../functions.php';
$dry = 1 - intval(@file_get_contents($realrun_file));
$previously_affected = trim(file_get_contents($record_file));
if ($previously_affected) {
    $previously_affected = explode(',', $previously_affected);
    $previously_affected = array_unique($previously_affected);
} else {
    $previously_affected = array();
}
if ($dry) {
    print "This is a DRY RUN. The actions below are NOT happening for real.\n";
} else {
    print "This is NOT a dry run. The actions below ARE happening for real.\n";
}
include dirname(__FILE__) . '/MechanicalTurk.class.php';
$mturk = new MechanicalTurk(MTURK_KEY, MTURK_SECRET);
$wids_aids = $mturk->getWorkersAndAssignmentsForHIT(HIT_ID);
$wids = $wids_aids['wids'];
$aids = $wids_aids['aids'];
print "Found " . count($wids) . " workers to record (from mturk).\n";
print "Found " . count($aids) . " assignments to record (from mturk).\n";
print "Found " . count($previously_affected) . " workers already affected (from {$record_file}).\n";
print "Found " . count(array_diff($wids, $previously_affected)) . " new workers to act on.\n";
print "\n------------------------------";
print "\nPAYING...DO NOT EXIT";
print "\n------------------------------\n";
//APPROVE HIT
$num_accepted = 0;
$num_rejected = 0;
$raw_total_bonus = 0;
$num_50 = 0;
 public static function is_valid($request)
 {
     return MechanicalTurk::get_response_element($request, 'IsValid') === 'True';
 }