/**
  * Test stop does not leave output buffers open
  */
 public function testStopDoesNotLeaveOutputBuffersOpen()
 {
     $level_start = ob_get_level();
     $s = new \Slim\Slim();
     $s->get('/bar', function () use($s) {
         $s->stop();
     });
     $s->run();
     $this->assertEquals($level_start, ob_get_level());
 }
Beispiel #2
0
//
//	URL:	/api/v1/people
//	Method: POST
//	Params: userid (required)
//			lastname, firstname, phone1, phone2, phone3, email, adminowndevices,
//			readaccess, writeaccess, deleteaccess, contactadmin, rackrequest,
//			rackadmin, siteadmin
//	Returns: record as modified
//
$app->post('/people/:personid', function ($personid) use($app, $person) {
    if (!$person->ContactAdmin) {
        $response['error'] = true;
        $response['errorcode'] = 400;
        $response['message'] = __("Insufficient privilege level");
        echoResponse(200, $response);
        $app->stop();
    }
    $response = array();
    $p = new People();
    $p->PersonID = $personid;
    if (!$p->GetPerson()) {
        $response['error'] = true;
        $response['errorcode'] = 404;
        $response['message'] = __("User not found in database.");
        echoResponse(200, $response);
    } else {
        // Slim Framework will simply return null for any variables that were not passed, so this is safe to call without blowing up the script
        foreach ($p as $prop) {
            $p->{$prop} = $app->request->post($prop);
        }
        $p->Disabled = false;