<?php require "../vendor/autoload.php"; require "conf/config.php"; $app = new \PropelToSlim\PropelToSlim(array("propelToSlim" => array("schemaPath" => "schema.xml", "api" => array("basePath" => "api"), "admin" => array("basPath" => "admin"), "auth" => array("method" => "simple", "model" => "user", "username" => "name", "password" => "password")))); $app->get('/', function () use($app) { echo "hello world"; }); $app->initApi(); $app->run();
$passwordConfirm = $app->request->post('confirm-password'); //attempt to make user $isValid = true; if (\SpoilerWiki\User::userNameExists($userName)) { $isValid = false; $errors['username_exists'] = "An account with this user name already exists"; } if ($password !== $passwordConfirm) { $isValid = false; $errors['password_mismatch'] = "The passwords don't match"; } if ($emailAddress != "" && \SpoilerWiki\User::emailExists($emailAddress)) { $isValid = false; $errors['email_exists'] = "An account is already registered with this email address"; } if ($isValid) { $newUser = new \SpoilerWiki\User(); $newUser->setUsername($userName); $newUser->setPassword($password); $newUser->setEmail($emailAddress); $newUser->save(); $app->redirect('/login?registered=true'); } } $app->view()->display('register.twig', array("errors" => $errors)); })->via('POST', 'GET'); $propelApi = new \PropelToSlim\PropelToSlim($app, '../schema.xml'); $propelApi->generateRoutes(); $artist = new \SpoilerWiki\ArtistQuery(); //$artist->filterBy() $app->run();