$ind = json_decode($data, true); } $update = array(); $update['id'] = $id; $update['last_updated'] = $now; $ind[$ini['industry']][$ini['industry_page']] = $update; $data = json_encode($ind); file_put_contents('./video/dat/industry.dat', $data); Unlock($indLock); } } } if ($testInfo_dirty) { SaveTestInfo($id, $testInfo); } SecureDir($testPath); UnlockTest($testLock); /************************************************************************* * Do No modify TestInfo after this point **************************************************************************/ // do any post-processing when the full test is complete that doesn't rely on testinfo if ($done) { logTestMsg($id, "Test Complete"); // send an async request to the post-processing code so we don't block SendAsyncRequest("/work/postprocess.php?test={$id}"); } } else { logMsg("location key incorrect\n"); } } }
// create a new test id $today = new DateTime("now", new DateTimeZone('America/New_York')); $id = $today->format('ymd_') . ShardKey(rand()) . md5(uniqid(rand(), true)); $path = './' . GetTestPath($id); // create the folder for the test results if (!is_dir($path)) { mkdir($path, 0777, true); } // extract the zip file $archive = new PclZip($_FILES['file']['tmp_name']); $list = $archive->extract(PCLZIP_OPT_PATH, "{$path}/"); if (!$list) { unset($id); } // make sure there are no risky files and that nothing is allowed execute permission SecureDir($path); // mark the test as piblished so we won't expose a resubmit $lock = LockTest($id); if ($lock) { $testInfo = GetTestInfo($id); if ($testInfo) { $testInfo['id'] = $id; $testInfo['job'] = $id; $testInfo['published'] = true; if (array_key_exists('noscript', $_REQUEST) && $_REQUEST['noscript']) { $testInfo['script'] = null; } SaveTestInfo($id, $testInfo); } UnlockTest($lock); }