@@ -0,0 +1,78 @@ | |||
<?php | |||
use Twig\Environment; | |||
use Twig\Error\LoaderError; | |||
use Twig\Error\RuntimeError; | |||
use Twig\Extension\SandboxExtension; | |||
use Twig\Markup; | |||
use Twig\Sandbox\SecurityError; | |||
use Twig\Sandbox\SecurityNotAllowedTagError; | |||
use Twig\Sandbox\SecurityNotAllowedFilterError; | |||
use Twig\Sandbox\SecurityNotAllowedFunctionError; | |||
use Twig\Source; | |||
use Twig\Template; | |||
/* create.html.twig */ | |||
class __TwigTemplate_a100f087ead1bdb74f2ec24f4e82ad8bae916c67971e9c87edbfc294d33aae3f extends Template | |||
{ | |||
private $source; | |||
private $macros = []; | |||
public function __construct(Environment $env) | |||
{ | |||
parent::__construct($env); | |||
$this->source = $this->getSourceContext(); | |||
$this->parent = false; | |||
$this->blocks = [ | |||
]; | |||
} | |||
protected function doDisplay(array $context, array $blocks = []) | |||
{ | |||
$macros = $this->macros; | |||
// line 1 | |||
echo "<html> | |||
<body> | |||
<h1>Dev Server 2.2 </h1> | |||
<div class=\"rendered-form\"> | |||
<div class=> | |||
<h2>Create User Account</h2></div> | |||
<div> | |||
<form> | |||
<label for=\"username\">Username<span >*</span></label>\" | |||
<input type=\"text\" placeholder=\"John Doe\" class=\"form-control\" name=\"username\" access=\"false\" maxlength=\"40\" id=\"text-1646406138879\" required=\"required\" aria-required=\"true\"> | |||
</div> | |||
<div> | |||
<label for=\"email\">Email<span>*</span></label> | |||
<input type=\"email\" placeholder=\"johndoe@gmail.com\" name=\"email\"> | |||
</div> | |||
<div> | |||
<label for=\"credit\">Credits<span>*</span></label> | |||
<input type=\"text\" placeholder=\"100\" name=\"credit\"> | |||
</div> | |||
<div> | |||
<button method=\"POST\" type=\"submit\">Submit</button> | |||
</div> | |||
</form> | |||
</div>; | |||
</body>"; | |||
} | |||
public function getTemplateName() | |||
{ | |||
return "create.html.twig"; | |||
} | |||
public function getDebugInfo() | |||
{ | |||
return array ( 37 => 1,); | |||
} | |||
public function getSourceContext() | |||
{ | |||
return new Source("", "create.html.twig", "/src/templates/create.html.twig"); | |||
} | |||
} |
@@ -1,7 +1,8 @@ | |||
{ | |||
"require": { | |||
"slim/slim": "4.*", | |||
"slim/psr7": "^1.5" | |||
"slim/psr7": "^1.5", | |||
"twig/twig": "^3.0" | |||
}, | |||
"config": { | |||
"platform-check": false |
@@ -4,7 +4,7 @@ | |||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", | |||
"This file is @generated automatically" | |||
], | |||
"content-hash": "285ddc9ddeefce0b996c355da865d991", | |||
"content-hash": "599b28b1091417b9a8e23442a8e6220a", | |||
"packages": [ | |||
{ | |||
"name": "fig/http-message-util", | |||
@@ -677,6 +677,171 @@ | |||
"time": "2021-10-05T03:00:00+00:00" | |||
}, | |||
{ | |||
"name": "symfony/polyfill-ctype", | |||
"version": "v1.25.0", | |||
"source": { | |||
"type": "git", | |||
"url": "https://github.com/symfony/polyfill-ctype.git", | |||
"reference": "30885182c981ab175d4d034db0f6f469898070ab" | |||
}, | |||
"dist": { | |||
"type": "zip", | |||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", | |||
"reference": "30885182c981ab175d4d034db0f6f469898070ab", | |||
"shasum": "" | |||
}, | |||
"require": { | |||
"php": ">=7.1" | |||
}, | |||
"provide": { | |||
"ext-ctype": "*" | |||
}, | |||
"suggest": { | |||
"ext-ctype": "For best performance" | |||
}, | |||
"type": "library", | |||
"extra": { | |||
"branch-alias": { | |||
"dev-main": "1.23-dev" | |||
}, | |||
"thanks": { | |||
"name": "symfony/polyfill", | |||
"url": "https://github.com/symfony/polyfill" | |||
} | |||
}, | |||
"autoload": { | |||
"files": [ | |||
"bootstrap.php" | |||
], | |||
"psr-4": { | |||
"Symfony\\Polyfill\\Ctype\\": "" | |||
} | |||
}, | |||
"notification-url": "https://packagist.org/downloads/", | |||
"license": [ | |||
"MIT" | |||
], | |||
"authors": [ | |||
{ | |||
"name": "Gert de Pagter", | |||
"email": "BackEndTea@gmail.com" | |||
}, | |||
{ | |||
"name": "Symfony Community", | |||
"homepage": "https://symfony.com/contributors" | |||
} | |||
], | |||
"description": "Symfony polyfill for ctype functions", | |||
"homepage": "https://symfony.com", | |||
"keywords": [ | |||
"compatibility", | |||
"ctype", | |||
"polyfill", | |||
"portable" | |||
], | |||
"support": { | |||
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" | |||
}, | |||
"funding": [ | |||
{ | |||
"url": "https://symfony.com/sponsor", | |||
"type": "custom" | |||
}, | |||
{ | |||
"url": "https://github.com/fabpot", | |||
"type": "github" | |||
}, | |||
{ | |||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony", | |||
"type": "tidelift" | |||
} | |||
], | |||
"time": "2021-10-20T20:35:02+00:00" | |||
}, | |||
{ | |||
"name": "symfony/polyfill-mbstring", | |||
"version": "v1.25.0", | |||
"source": { | |||
"type": "git", | |||
"url": "https://github.com/symfony/polyfill-mbstring.git", | |||
"reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" | |||
}, | |||
"dist": { | |||
"type": "zip", | |||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", | |||
"reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", | |||
"shasum": "" | |||
}, | |||
"require": { | |||
"php": ">=7.1" | |||
}, | |||
"provide": { | |||
"ext-mbstring": "*" | |||
}, | |||
"suggest": { | |||
"ext-mbstring": "For best performance" | |||
}, | |||
"type": "library", | |||
"extra": { | |||
"branch-alias": { | |||
"dev-main": "1.23-dev" | |||
}, | |||
"thanks": { | |||
"name": "symfony/polyfill", | |||
"url": "https://github.com/symfony/polyfill" | |||
} | |||
}, | |||
"autoload": { | |||
"files": [ | |||
"bootstrap.php" | |||
], | |||
"psr-4": { | |||
"Symfony\\Polyfill\\Mbstring\\": "" | |||
} | |||
}, | |||
"notification-url": "https://packagist.org/downloads/", | |||
"license": [ | |||
"MIT" | |||
], | |||
"authors": [ | |||
{ | |||
"name": "Nicolas Grekas", | |||
"email": "p@tchwork.com" | |||
}, | |||
{ | |||
"name": "Symfony Community", | |||
"homepage": "https://symfony.com/contributors" | |||
} | |||
], | |||
"description": "Symfony polyfill for the Mbstring extension", | |||
"homepage": "https://symfony.com", | |||
"keywords": [ | |||
"compatibility", | |||
"mbstring", | |||
"polyfill", | |||
"portable", | |||
"shim" | |||
], | |||
"support": { | |||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" | |||
}, | |||
"funding": [ | |||
{ | |||
"url": "https://symfony.com/sponsor", | |||
"type": "custom" | |||
}, | |||
{ | |||
"url": "https://github.com/fabpot", | |||
"type": "github" | |||
}, | |||
{ | |||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony", | |||
"type": "tidelift" | |||
} | |||
], | |||
"time": "2021-11-30T18:21:41+00:00" | |||
}, | |||
{ | |||
"name": "symfony/polyfill-php80", | |||
"version": "v1.25.0", | |||
"source": { | |||
@@ -758,6 +923,82 @@ | |||
} | |||
], | |||
"time": "2022-03-04T08:16:47+00:00" | |||
}, | |||
{ | |||
"name": "twig/twig", | |||
"version": "v3.3.8", | |||
"source": { | |||
"type": "git", | |||
"url": "https://github.com/twigphp/Twig.git", | |||
"reference": "972d8604a92b7054828b539f2febb0211dd5945c" | |||
}, | |||
"dist": { | |||
"type": "zip", | |||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/972d8604a92b7054828b539f2febb0211dd5945c", | |||
"reference": "972d8604a92b7054828b539f2febb0211dd5945c", | |||
"shasum": "" | |||
}, | |||
"require": { | |||
"php": ">=7.2.5", | |||
"symfony/polyfill-ctype": "^1.8", | |||
"symfony/polyfill-mbstring": "^1.3" | |||
}, | |||
"require-dev": { | |||
"psr/container": "^1.0", | |||
"symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" | |||
}, | |||
"type": "library", | |||
"extra": { | |||
"branch-alias": { | |||
"dev-master": "3.3-dev" | |||
} | |||
}, | |||
"autoload": { | |||
"psr-4": { | |||
"Twig\\": "src/" | |||
} | |||
}, | |||
"notification-url": "https://packagist.org/downloads/", | |||
"license": [ | |||
"BSD-3-Clause" | |||
], | |||
"authors": [ | |||
{ | |||
"name": "Fabien Potencier", | |||
"email": "fabien@symfony.com", | |||
"homepage": "http://fabien.potencier.org", | |||
"role": "Lead Developer" | |||
}, | |||
{ | |||
"name": "Twig Team", | |||
"role": "Contributors" | |||
}, | |||
{ | |||
"name": "Armin Ronacher", | |||
"email": "armin.ronacher@active-4.com", | |||
"role": "Project Founder" | |||
} | |||
], | |||
"description": "Twig, the flexible, fast, and secure template language for PHP", | |||
"homepage": "https://twig.symfony.com", | |||
"keywords": [ | |||
"templating" | |||
], | |||
"support": { | |||
"issues": "https://github.com/twigphp/Twig/issues", | |||
"source": "https://github.com/twigphp/Twig/tree/v3.3.8" | |||
}, | |||
"funding": [ | |||
{ | |||
"url": "https://github.com/fabpot", | |||
"type": "github" | |||
}, | |||
{ | |||
"url": "https://tidelift.com/funding/github/packagist/twig/twig", | |||
"type": "tidelift" | |||
} | |||
], | |||
"time": "2022-02-04T06:59:48+00:00" | |||
} | |||
], | |||
"packages-dev": [], | |||
@@ -768,5 +1009,5 @@ | |||
"prefer-lowest": false, | |||
"platform": [], | |||
"platform-dev": [], | |||
"plugin-api-version": "2.1.0" | |||
"plugin-api-version": "2.2.0" | |||
} |
@@ -8,11 +8,16 @@ use Psr\Http\Message\ResponseInterface as Response; | |||
use Psr\Http\Message\ServerRequestInterface as Request; | |||
use Slim\Factory\AppFactory; | |||
use Slim\Exception\NotFoundException; | |||
use Twig\Loader\FilesytemLoader; | |||
use Users\DB; | |||
require __DIR__. '/../vendor/autoload.php'; | |||
$loader = new \Twig\Loader\FilesystemLoader('../templates'); | |||
$twig = new \Twig\Environment($loader, [ | |||
//'cache' => '../cache' | |||
]); | |||
$app = AppFactory::create(); //:: static create | |||
@@ -27,26 +32,11 @@ $app->map(['GET', 'POST'],'/create', function(Request $request, Response $respon | |||
$db->loadUsers(); | |||
if($request->getMethod()=='GET'){ | |||
$response->getBody()->write('<h1> Dev Server 2.1 </h1>'); | |||
$response->getBody()->write('<div class="rendered-form"> | |||
<div class=""> | |||
<h2 access="false" id="control-9200730">Create User Account</h2></div> | |||
<div class="formbuilder-text form-group field-text-1646406138879"> | |||
<label for="username" class="formbuilder-text-label">Username<span class="formbuilder-required">*</span></label>" | |||
<input type="text" placeholder="John Doe" class="form-control" name="username" access="false" maxlength="40" id="text-1646406138879" required="required" aria-required="true"> | |||
</div> | |||
<div class="formbuilder-text form-group field-text-1646406139872"> | |||
<label for="email" class="formbuilder-text-label">Emai<span class="formbuilder-required">*</span></label> | |||
<input type="email" placeholder="johndoe@gmail.com" class="form-control" name="email" access="false" id="text-1646406139872" required="required" aria-required="true"> | |||
</div> | |||
<div class="formbuilder-text form-group field-text-1646406140881"> | |||
<label for="credit" class="formbuilder-text-label">Credits<span class="formbuilder-required">*</span></label> | |||
<input type="text" placeholder="100" class="form-control" name="credit" access="false" id="text-1646406140881" required="required" aria-required="true"> | |||
</div> | |||
<div class="formbuilder-button form-group field-button-1646406142708"> | |||
<button method="post" type="submit" class="btn-success btn" name="submit" access="false" style="success" id="button-1646406142708">Submit</button> | |||
</div> | |||
</div>'); | |||
global $twig; | |||
$template = $twig->load('create.html.twig'); | |||
$render = $template->render(['the' => 'variables', 'go' => 'here']); | |||
$response->getBody()->write($render); | |||
return $response; | |||
} | |||
else{ | |||
$parsedBody = $request->getParsedBody(); | |||
@@ -68,7 +58,7 @@ $app->map(['GET', 'POST'],'/create', function(Request $request, Response $respon | |||
}); | |||
$app->get('/}', function(Request $request, Response $response, $args){ | |||
$app->get('/', function(Request $request, Response $response, $args){ | |||
$name = '/create'; | |||
$response->getBody()->write('Welcome to the 2.1 dev server, to create user copy this link in your URL bar'.' '. $name); | |||
return $response; |
@@ -0,0 +1,25 @@ | |||
<html> | |||
<body> | |||
<h1>Dev Server 2.2 </h1> | |||
<div class="rendered-form"> | |||
<div class=> | |||
<h2>Create User Account</h2></div> | |||
<div> | |||
<form> | |||
<label for="username">Username<span >*</span></label>" | |||
<input type="text" placeholder="John Doe" class="form-control" name="username" access="false" maxlength="40" id="text-1646406138879" required="required" aria-required="true"> | |||
</div> | |||
<div> | |||
<label for="email">Email<span>*</span></label> | |||
<input type="email" placeholder="johndoe@gmail.com" name="email"> | |||
</div> | |||
<div> | |||
<label for="credit">Credits<span>*</span></label> | |||
<input type="text" placeholder="100" name="credit"> | |||
</div> | |||
<div> | |||
<button method="POST" type="submit">Submit</button> | |||
</div> | |||
</form> | |||
</div>; | |||
</body> |