FacebookSession::setDefaultApplication(Config::FaceBook_App_Id, Config::FaceBook_App_Secret);
$facebookSession = FacebookSession::newAppSession();
// To validate the session:
try {
    $facebookSession->validate();
} catch (FacebookRequestException $ex) {
    // Session not valid, Graph API returned an exception with the reason.
    echo $ex->getMessage();
} catch (\Exception $ex) {
    // Graph API returned info, but it may mismatch the current app or have expired.
    echo $ex->getMessage();
}
// Instantiate the Slim app
require 'lib/Slim/Slim.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
$app->response->headers->set('Content-Type', 'application/json');
// Return the correct headers for OPTIONS requests
$app->options('/(:name+)', function () use($app) {
    $app->response()->header('Access-Control-Allow-Origin', 'http://localhost:8234/');
    //Allow JSON data to be consumed
    $app->response()->header('Access-Control-Allow-Headers', 'X-Requested-With, X-authentication, X-client');
    //Allow JSON data to be consumed
});
// set up the response object
$response = array('success' => FALSE, 'action' => NULL, 'error' => NULL, 'data' => NULL);
// Include Web Methods
require_once 'methods/twitter.php';
require_once 'methods/facebook.php';
// Run the app
$app->run();
Example #2
0
{
    return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $salt, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
}
function simple_decrypt($text, $salt)
{
    return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $salt, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)));
}
$app = new \Slim\Slim();
$app->enc_key = '1234567891011214';
$app->config('databases', ['default' => ['driver' => 'mysql', 'host' => 'sql4.freemysqlhosting.net', 'database' => 'sql497075', 'username' => 'sql497075', 'password' => 'qSzcljxNL5', 'charset' => 'utf8', 'collation' => 'utf8_general_ci', 'prefix' => '']]);
$app->add(new Zeuxisoo\Laravel\Database\Eloquent\ModelMiddleware());
$app->view(new \JsonApiView());
$app->add(new \JsonApiMiddleware());
$app->add(new \Slim\Middleware\ContentTypes());
$app->options('/(:name+)', function () use($app) {
    $app->render(200, array('msg' => 'API-True'));
});
$app->get('/', function () use($app) {
    $app->render(200, array('msg' => 'API-True'));
});
$app->get('/usuario', function () use($app) {
    $db = $app->db->getConnection();
    $users = $db->table('users')->select('id', 'usuario')->get();
    $app->render(200, array('data' => $users));
});
$app->get('/sensor', function () use($app) {
    $db = $app->db->getConnection();
    $sensores = $db->table('sensores')->select('id', 'nombre', 'humedad', 'updated_at')->get();
    $app->render(200, array('data' => $sensores));
});
$app->post('/sensor', function () use($app) {
Example #3
0
    header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
    header('Access-Control-Allow-Credentials: true');
    header('Access-Control-Max-Age: 86400');
    // cache for 1 day
}
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
    if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) {
        header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");
    }
    if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) {
        header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
    }
}
// instead of mapping:
$app->options('/(:x+)', function () use($app) {
    //...return correct headers...
    $app->response->setStatus(200);
});
// Configuramos las vistas
$app->config(array('templates.path' => 'app/views'));
// Configuramos la pagina 404
$app->notFound(function () use($app) {
    $app->render('404.php', array('title_page' => 'Página no encontrada | '));
});
// Definimos la constante de seguridad
define('SEGURIDAD', true);
// Incluimos los archivos de la aplicacion
require_once 'app/db.php';
//require_once 'app/hook.php';
require_once 'app/middleware/middleware.php';
require_once 'app/filters.php';
require_once 'app/routes/routes.php';
// 		$contents = file_get_contents('documentation/README.md');
// 		$parsedown = new Parsedown();
// 		echo $parsedown->text($contents);
// 	});
// 	$app->get('/routes', function() {
// 		$contents = file_get_contents('documentation/routes.md');
// 		$parsedown = new Parsedown();
// 		echo $parsedown->text($contents);
// 	});
// });
$app->post('/authenticate', function () {
    echo "successfully authenticated.";
});
$app->options('/register', function () use($app) {
    echo "{ 'success': 'true' }";
    $app->response->headers->set("Allow", "GET,HEAD,POST,OPTIONS,TRACE");
    $app->response->headers->set("Content-type", "application/json");
});
$app->post('/register', function () {
    $request = \Slim\Slim::getInstance()->request();
    $response = \Slim\Slim::getInstance()->response();
    if ($payload = json_decode($request->getBody())) {
        //Successfully decoded JSON object.
        if ($payload->email && $payload->name) {
            $row = \FormAPI\AuthService::fetchRequester($payload->email, $payload->name);
            $jwt = \FormAPI\AuthService::generate($row['requester_id'], $row['email_address']);
            if (\FormAPI\AuthService::save($row['requester_id'], $jwt)) {
                $result['success'] = true;
                $result['jwt'] = $jwt;
                echo json_encode($result);
            } else {
Example #5
0
$app->put('/:resource/:id(/)', function ($resource, $id = null) {
    $resource = \App\Resource::load($resource);
    if ($resource === null) {
        \App\Resource::response(\App\Resource::STATUS_NOT_FOUND);
    } else {
        $resource->put($id);
    }
});
// Delete
$app->delete('/:resource/:id(/)', function ($resource, $id = null) {
    $resource = \App\Resource::load($resource);
    if ($resource === null) {
        \App\Resource::response(\App\Resource::STATUS_NOT_FOUND);
    } else {
        $resource->delete($id);
    }
});
// Options
$app->options('/:resource(/)', function ($resource, $id = null) {
    $resource = \App\Resource::load($resource);
    if ($resource === null) {
        \App\Resource::response(\App\Resource::STATUS_NOT_FOUND);
    } else {
        $resource->options();
    }
});
// Not found
$app->notFound(function () {
    \App\Resource::response(\App\Resource::STATUS_NOT_FOUND);
});
$app->run();
Example #6
0
        return $r->respond(400, 'BAD REQUEST', true);
    }
    $data = R::findOne($tableName, 'id = ?', array($id));
    if ($data) {
        $existingSyncMeta = R::findOne('syncmeta', 'where row_id = ? and tableName = ?', array($id, $tableName));
        if ($existingSyncMeta) {
            $existingSyncMeta->type = 'remove';
            $existingSyncMeta->timestamp = date('Y-m-d H:i:s');
            R::store($existingSyncMeta);
        }
        if ($r->fireHookIfExists($package, $name, 'beforeRemove', $r->unserialize(array($data->export()))[0])) {
            R::trash($data);
            $r->fireHookIfExists($package, $name, 'afterRemove', $r->unserialize(array($data->export()))[0]);
            return $r->respond(200, 'DELETED');
        }
        return $r->respond(403, 'FORBIDDEN:HOOK', true);
    }
    return $r->respond(404, 'NOT FOUND', true);
});
/* Handle Options Route */
$app->options('/:any+', 'API', function () use($app, $r) {
    return $r->respond(200);
});
/* default 404 and Error Handler */
$app->error('API', function (\Exception $e) use($app) {
    return $r->respond(500, $e, true);
});
$app->notFound('API', function () use($r) {
    return $r->respond(404, 'NOT FOUND', true);
});
$app->run();
Example #7
0
$capsule = new Capsule();
$capsule->addConnection(array('driver' => 'mysql', 'host' => getenv('DB_HOST'), 'database' => getenv('DB_NAME'), 'username' => getenv('DB_USER'), 'password' => getenv('DB_PASS'), 'charset' => 'utf8', 'collation' => 'utf8_general_ci', 'prefix' => ''));
$capsule->setAsGlobal();
$capsule->bootEloquent();
// Create Slim app
$app = new \Slim\Slim(array('log.enabled' => true, 'log.level' => \Slim\Log::DEBUG, 'log.writer' => $monolog));
//setup jwt auth
$app->add(new \Slim\Middleware\JwtAuthentication(["secure" => false, "secret" => getenv("JWT_SECRET"), "callback" => function ($options) use($app) {
    $app->jwt = $options["decoded"];
}, "rules" => [new \Slim\Middleware\JwtAuthentication\RequestPathRule(["path" => "/", "passthrough" => array("/login")]), new \Slim\Middleware\JwtAuthentication\RequestMethodRule(["passthrough" => ["OPTIONS"]])]]));
#################################################
#################### Routes #####################
#################################################
//accept all options
$app->options('/(:name+)', function () use($app) {
    $app->response->setStatus(200);
});
$app->get('/', function () use($app) {
    $app->response->setStatus(200);
    echo "Reach API v1.0";
});
$app->post('/login', function () use($app) {
    doLogin();
});
$app->post('/pusher/auth', function () use($app) {
    $app->response->setStatus(200);
    $app_id = getenv('PUSHER_APP_ID');
    $app_key = getenv('PUSHER_APP_KEY');
    $app_secret = getenv('PUSHER_APP_SECRET');
    $pusher = new Pusher($app_key, $app_secret, $app_id);
    echo $pusher->socket_auth($_POST['channel_name'], $_POST['socket_id']);
Example #8
0
    // get the users from json data
    $icons_data = file_get_contents(DATA_DIR . 'icons/fa.json');
    $users = json_decode($icons_data, true);
    if (null !== $users) {
        $app->response->setStatus(200);
        echo json_encode($users);
    } else {
        $app->response->setStatus(401);
    }
});
// data functions
function get_contacts()
{
    // get the users from json data
    $contacts_data = file_get_contents(DATA_DIR . 'email/contacts.json');
    return json_decode($contacts_data, true);
}
// Options stubs
$app->options('/login', function () {
});
$app->options('/signup', function () {
});
$app->options('/reset', function () {
});
$app->options('/email/inbox', function () {
});
$app->options('/email/contacts', function () {
});
$app->options('/elements/icons', function () {
});
$app->run();
Example #9
0
 private function runAppPreFlight($action, $actionName, $mwOptions = NULL, $headers = array())
 {
     \Slim\Environment::mock(array('REQUEST_METHOD' => 'OPTIONS', 'SERVER_NAME' => 'localhost', 'SERVER_PORT' => 80, 'ACCEPT' => 'application/json', 'SCRIPT_NAME' => '/index.php', 'PATH_INFO' => '/' . $actionName));
     $app = new \Slim\Slim();
     $app->setName($actionName);
     $mw = function () {
         // Do nothing
     };
     if (isset($mwOptions)) {
         if (is_callable($mwOptions)) {
             $mw = $mwOptions;
         } else {
             $mwOptions['appName'] = $actionName;
             $mw = \CorsSlim\CorsSlim::routeMiddleware($mwOptions);
         }
     }
     $app->options('/:name', $mw, function ($name) use($app, $action) {
     });
     $app->delete('/:name', $mw, function ($name) use($app, $action) {
         if ($app->request->isHead()) {
             $app->status(204);
             return;
         }
         $app->contentType('application/json');
         $app->response->write(json_encode(array("action" => $action, "method" => "DELETE", "name" => $name)));
     });
     foreach ($headers as $key => $value) {
         $app->request->headers()->set($key, $value);
     }
     $app->run();
     return $app;
 }
        $app->render(200, array());
    });
    $app->put('/:id/:index', function ($id, $index) use($app) {
        $session = new Session($id);
        $result = json_decode($app->request->getBody(), true);
        if (false != $result) {
            $index = $session->saveResult($result, $index);
            $result['id'] = $index;
            Notify(ADMIN_TOPIC, array('action' => 'result', 'session' => $session->getInfo(), 'result' => $result));
            $app->render(200, array());
        } else {
            $app->render(400, array('error' => true, 'msg' => 'Not JSON'));
        }
    });
    $app->options('/:param+', function ($param) use($app) {
        $app->render(200, array());
    });
});
$app->group('/references', function () use($app) {
    $app->get('/', function () use($app) {
        $references = array();
        if ($dh = opendir(REFERENCE_DIR)) {
            while (($file = readdir($dh)) !== false) {
                if (Reference::isValidResults($file)) {
                    $reference = new Reference($file);
                    $referenceInfo = $reference->getInfo();
                    $referenceInfo['href'] = $app->urlFor('references', array('id' => $file));
                    array_push($references, $referenceInfo);
                }
            }
            closedir($dh);
Example #11
0
<?php

//error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
//ini_set('display_errors','On');
//$_SERVER['REQUEST_METHOD'];
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim(array('debug' => true));
$app->options('/:anything+', function () use($app) {
    $res = $app->response();
    $res->headers->set('Access-Control-Allow-Headers', 'Content-Type, Authorization, Accept, X-HTTP-Method-Override');
    $res->headers->set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE');
    $res->headers->set('Access-Control-Allow-Origin', '*');
    $res->headers->set('Access-Control-Allow-Credentials', 'true');
    $res->status(200);
});
// READ THE ROUTES CONFIG FILE
$api = json_decode(file_get_contents("_apibuilder/api/api.json", false));
foreach ($api as $entry) {
    if (isset($entry->method) && isset($entry->address)) {
        $route = $entry;
        $app->map($route->address, function () use($app, $route) {
            $req = $app->request();
            $res = $app->response();
            $res->headers->set('Access-Control-Allow-Origin', '*');
            $res->headers->set('Access-Control-Allow-Headers', 'X-HTTP-Method-Override');
            // PARAMETERS WILL BE IN AN ARRAY
            $params = array();
            // AUTHENTICATION
            if (isset($route->auth) && $route->auth == true) {
                $username = $req->headers('PHP_AUTH_USER');
                $result = call_procedure('authenticate', array($username));
Example #12
0
 * @link       https://github.com/DevelopersPL/DevAAC
 */
// Autoload our dependencies with Composer
$loader = (require '../vendor/autoload.php');
$loader->setPsr4('DevAAC\\', APP_ROOT);
//////////////////////// CREATE Slim APPLICATION //////////////////////////////////
$DevAAC = new \Slim\Slim(array('debug' => ENABLE_DEBUG));
$DevAAC->add(new \Slim\Middleware\ContentTypes());
//$DevAAC->response->headers->set('Content-Type', 'application/json'); // by default we return json
////////////////////// ALLOW CROSS-SITE REQUESTS (OR NOT) /////////////////////////
if (CORS_ALLOW_ORIGIN) {
    $DevAAC->response->headers->set('Access-Control-Allow-Origin', CORS_ALLOW_ORIGIN);
    $DevAAC->response->headers->set('Access-Control-Allow-Headers', 'Authorization, Origin, Content-Type, Accept');
    $DevAAC->response->headers->set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE');
    $DevAAC->response->headers->set('Access-Control-Allow-Credentials', 'true');
    $DevAAC->options(':a+', function ($a) {
    });
    // Send blank 200 to every OPTIONS request
}
$DevAAC->container->singleton('request', function ($c) {
    return new DevAAC\Http\Request($c['environment']);
});
//////////////////// DEFINE AUTHENTICATION MIDDLEWARE ////////////////////////////
// http://docs.slimframework.com/#Middleware-Overview
class AuthMiddleware extends \Slim\Middleware
{
    public function call()
    {
        $req = $this->app->request();
        $auth_user = $req->headers('PHP_AUTH_USER');
        $auth_pass = $req->headers('PHP_AUTH_PW');
        if ($auth_user && $auth_pass) {
Example #13
0
    };
}
function exportCSV($query, $headerArray, $filename)
{
    $conn = Connection::getInstance();
    $statement = $conn->db->prepare($query);
    $statement->setFetchMode(PDO::FETCH_ASSOC);
    $statement->execute();
    $csv = Writer::createFromFileObject(new SplTempFileObject());
    $csv->insertOne($headerArray);
    $csv->insertAll($statement);
    $csv->output($filename . '.csv');
    die;
}
// Options to enable CORS on /+
$app->options('/(:name+)', function () use($app) {
});
//LOGIN
$app->post('/login', function () use($app) {
    // header altijd nodig
    $app->response->headers->set('Content-Type', 'application/json');
    // check of we proberen te posten "inloggen vanaf zelfde site"
    // zo niet dan halen we de credentials uit request body
    if (isset($_POST['email']) && isset($_POST['password'])) {
        $email = $_POST['email'];
        $password = $_POST['password'];
    } else {
        $credentials = json_decode($app->request()->getBody());
        $email = $credentials->email;
        $password = $credentials->password;
    }
    $conn = Connection::getInstance();
Example #14
0
}
function simple_decrypt($text, $salt)
{
    return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $salt, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)));
}
$app = new \Slim\Slim();
//Clave encriptación de la APP:
$app->enc_key = '1234567891011121';
//Información de la Base de Datos.
$app->config('databases', ['default' => ['driver' => 'mysql', 'host' => 'eu-cdbr-west-01.cleardb.com', 'database' => 'heroku_53ae9716fdb16ba', 'username' => 'b3d11bcd2bf74a', 'password' => 'c4d85dcd', 'charset' => 'utf8', 'collation' => 'utf8_general_ci', 'prefix' => '']]);
$app->add(new Zeuxisoo\Laravel\Database\Eloquent\ModelMiddleware());
$app->view(new \JsonApiView());
$app->add(new \JsonApiMiddleware());
$app->add(new \Slim\Middleware\ContentTypes());
$app->options('/(:name+)', function () use($app) {
    $app->render(200, array('msg' => 'appService API V2'));
});
$app->get('/', function () use($app) {
    $app->render(200, array('msg' => 'appService API V2'));
});
//Módulos:
include 'modulos/login.php';
include 'modulos/perfil.php';
include 'modulos/usuarios/nuevousuario.php';
include 'modulos/usuarios/verificarusuario.php';
include 'modulos/usuarios/usuarios.php';
include 'modulos/usuarios/modificarusuario.php';
include 'modulos/usuarios/usuario.php';
include 'modulos/usuarios/borrarusuario.php';
include 'modulos/anuncios/listaranuncios.php';
include 'modulos/anuncios/crearanuncio.php';
  */
 $app->get('/searchJobs', function () use($app, $trucking) {
     $searchTerm = $app->request()->get('searchTerm');
     $result = $trucking->findBySearchTerm($searchTerm);
     if ($result != null) {
         echo json_encode($result);
     } else {
         echo '{"status":"fail", "message":"No records matched your search."}';
     }
 });
 /**
  * @description
  * @API /trucking/job      DELETE
  */
 $app->options('/job/:id', function ($id) use($app, $trucking) {
     // make sure user token is valid.
     echo 'The actual OPTIONS call. token: ';
 });
 $app->delete('/job/:id', function ($id) use($app, $trucking) {
     // make sure user token is valid.
     $token = $app->request()->get('token');
     if (isTokenValid($token) != null) {
         $decoded_array = isTokenValid($token);
         $owner_id = $decoded_array['data']->userId;
         // process request
         if ($trucking->deleteJobPost($id, $owner_id)) {
             // success deleting the job post
             echo '{"status":"OK", "message":"Job post removed succesfully"}';
         } else {
             // failure in deleting the item. The job post might have been removed already.
             echo '{"status":"fail", "message":"The job post might have been removed already"}';
         }
Example #16
0
});
$app->get('/schools', function () use($app) {
    $app->response()->header('Content-Type', 'application/json');
    echo School::all()->toJson();
});
$app->get('/skills', function () use($app) {
    $app->response()->header('Content-Type', 'application/json');
    echo Skill::all()->toJson();
});
$app->get('/occupation', function () use($app) {
    $app->response()->header('Content-Type', 'application/json');
    echo Skill::all()->toJson();
});
$app->group('/user', function () use($app) {
    $app->options('/:name', function ($name) use($app) {
        $app->response()->header('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE, OPTIONS');
    });
    $app->options('/', function () use($app) {
        $app->response()->header('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE, OPTIONS');
    });
    $app->options('/progress', function () use($app) {
        $app->response()->header('Access-Control-Allow-Methods', 'GET, OPTIONS');
    });
    $app->options('/talent/:name', function () use($app) {
        $app->response()->header('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE, OPTIONS');
    });
    $app->options('/occupation', function () {
        $app->response()->header('Access-Control-Allow-Methods', 'GET, OPTIONS');
    });
    $app->options('/skills', function () use($app) {
        $app->response()->header('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE, OPTIONS');
Example #17
0
<?php

require 'Slim/Slim.php';
require 'rb-p533.php';
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: Origin, X-Requested-With, X-Titanium-Id, Content-Type, Accept");
header("Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT");
header("Access-Control-Allow-Credentials: true");
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
R::setup('mysql:host=localhost;dbname=smartqna', 'root', 'denters0318');
$app->options('/mentors/:id', function () use($app) {
});
$app->options('/book/:id', function () use($app) {
});
$app->options('/school', function () use($app) {
});
$app->get('/init', function () use($app) {
    /*
    	//user
    	$user = R::dispense('user');
    
    	$user->uid 				= 'test';
    	$user->pass				= '******';
    
    	$user->name 			= 'name';
    	$user->orgname 		= 'org';
    
    	$user->regtime 		= 0;
    
    	$user->expdate 		= 0;
Example #18
0
$app->get('/get', function () {
    echo 'This is a GET route';
});
// PUT route
$app->put('/put', function () {
    echo 'This is a PUT route';
});
// PATCH route
$app->patch('/patch', function () {
    echo 'This is a PATCH route';
});
// DELETE route
$app->delete('/delete', function () {
    echo 'This is a DELETE route';
});
$app->options('/:sistema/:clase_control/:metodo', function ($sistema, $clase_control, $metodo) use($app) {
    $headers = $app->request->headers;
    header('Access-Control-Allow-Origin: ' . $headers['Origin']);
    header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
    header('Access-Control-Allow-Headers: pxp-user, content-type, Php-Auth-User, Php-Auth-Pw');
    header('Access-Control-Allow-Credentials: true');
    header('Access-Control-Max-Age: 1728000');
});
/**
 * Step 4: Run the Slim application
 *
 * This method should be called last. This executes the Slim application
 * and returns the HTTP response to the HTTP client.
 */
$app->run();
error_reporting(-1);
Example #19
0
 /**
  * Test OPTIONS route
  */
 public function testOptionsRoute()
 {
     \Slim\Environment::mock(array('REQUEST_METHOD' => 'OPTIONS', 'SCRIPT_NAME' => '/foo', 'PATH_INFO' => '/bar'));
     $s = new \Slim\Slim();
     $mw1 = function () {
         echo "foo";
     };
     $mw2 = function () {
         echo "bar";
     };
     $callable = function () {
         echo "xyz";
     };
     $route = $s->options('/bar', $mw1, $mw2, $callable);
     $s->call();
     $this->assertEquals('foobarxyz', $s->response()->body());
     $this->assertEquals('/bar', $route->getPattern());
     $this->assertSame($callable, $route->getCallable());
 }
Example #20
0
     if ($app->lists->getOwner($id) == $app->userid) {
         $entry = $app->lists->getEntry($id);
         $entry = $entry[0];
         $r = array();
         $r["id"] = $entry["id"];
         $r["name"] = $entry["name"];
         $r["list"] = $entry["list"];
         $r["aktive"] = $entry["aktive"];
         $res = array("status" => "ok", "resData" => $r);
         echo json_encode($res);
     } else {
         $res = array("status" => "fail");
         echo json_encode($res);
     }
 });
 $app->options('/:ids', function ($id) use($app) {
 });
 $app->delete("/:ids", function ($ids) use($app) {
     $entrys = explode(",", $ids);
     foreach ($entrys as $entryid) {
         if (is_numeric($entryid)) {
             if ($app->lists->getOwner($entryid) == $app->userid) {
                 $app->lists->rmEntry($entryid);
             } else {
                 echo '{"status":"wrong user id"}';
                 exit;
             }
         }
     }
     $res = array("status" => "ok");
     echo json_encode($res);
 });