$toc); | $toc); | ||||
break; | break; | ||||
case 'form': | |||||
$token_db = $f3->get('TEMP') . "CEform/"; | |||||
$form_config_file = sprintf("%s%s.cfg", | |||||
ROOT.$this->folder, | |||||
$request[1]); | |||||
$db = new \DB\Jig($token_db,\DB\Jig::FORMAT_JSON); | |||||
$formcall = new \DB\Jig\Mapper($db,'form_calls'); | |||||
$timestamp = time(); | |||||
$token = md5($timestamp . $form_config_file . rand(100,999)); | |||||
$f3->config($form_config_file); | |||||
$f3->set('fields', | |||||
array_merge( | |||||
$f3->get('fields'), | |||||
['xss-token'=>[ | |||||
'type'=>'hidden', | |||||
'value'=>$token, | |||||
'length'=>strlen($token) | |||||
]] | |||||
)); | |||||
$formcall->token = $token; | |||||
$formcall->timestamp = $timestamp; | |||||
$formcall->form = $form_config_file; | |||||
$formcall->save(); | |||||
$form_view = new \Template; | |||||
$new=$form_view->render('form.htm'); | |||||
break; | |||||
case 'box': | case 'box': | ||||
array_shift($request); //get rid of identifier | array_shift($request); //get rid of identifier | ||||
$type = array_shift($request); | $type = array_shift($request); | ||||
if (count($body) >= 3) { | if (count($body) >= 3) { | ||||
$caption = ['normal'=>['cap1' => array_shift($body), | $caption = ['normal'=>['cap1' => array_shift($body), | ||||
'cap2' => array_shift($body)], | 'cap2' => array_shift($body)], | ||||
'hover'=> ['cap1' => array_shift($body), | |||||
'hover'=> ['cap1' => array_shift($body), | |||||
'cap2' => array_shift($body)]]; | 'cap2' => array_shift($body)]]; | ||||
$caption_html=[]; | $caption_html=[]; | ||||
foreach ($caption as $state => $set) { | foreach ($caption as $state => $set) { |
<form action="{{ @target }}" method="post"> | |||||
<repeat group="{{ @fields }}" key="{{ @name }}" value="{{ @info }}"> | |||||
<check if="{{ @info.type == 'text' }}"> | |||||
<true> | |||||
<input | |||||
name="{{ @name }}" | |||||
id="{{ @name }}" | |||||
type="text" | |||||
size="{{ @info.length }}" | |||||
value="{{ @info.value }}" /> | |||||
<label for="{{ @name }}">{{ @info.description }}</label><br> | |||||
</true> | |||||
</check> | |||||
<check if="{{ @info.type == 'hidden' }}"> | |||||
<true> | |||||
<input | |||||
name="{{ @name }}" | |||||
id="{{ @name }}" | |||||
type="hidden" | |||||
value="{{ @info.value }}"/> | |||||
</true> | |||||
</check> | |||||
<check if="{{ @info.type == 'textarea' }}"> | |||||
<true> | |||||
<textarea | |||||
name="{{ @name }}" | |||||
id="{{ @name }}" | |||||
cols="{{ @info.cols }}" | |||||
rows="{{ @info.rows }}" >{{ @info.value }}</textarea> | |||||
<label for="{{ @name }}">{{ @info.description }}</label><br> | |||||
</true> | |||||
</check> | |||||
<check if="{{ @info.type == 'checkbox' }}"> | |||||
<true> | |||||
<repeat group="{{ @info.options }}" key="{{ @key }}" value="{{ @val }}"> | |||||
<input | |||||
type="checkbox" | |||||
id="{{ sprintf('%s[%s]',@name,@key) }}" | |||||
name="{{ sprintf('%s[%s]',@name,@key) }}" | |||||
value="true" | |||||
{{ is_array(@info.checked) ? in_array(@key,@info.checked) ? 'checked' : '' : !strcmp(@key,@info.checked) ? 'checked' : '' }} /> | |||||
<label for="{{ sprintf('%s[%s]',@name,@key) }}"> | |||||
{{ @val }}</label><br> | |||||
</repeat> | |||||
</true> | |||||
</check> | |||||
<check if="{{ @info.type == 'radio' }}"> | |||||
<true> | |||||
<repeat group="{{ @info.options }}" key="{{ @key }}" value="{{ @val }}"> | |||||
<input | |||||
type="radio" | |||||
id="{{ sprintf('%s-%s',@name,@key) }}" | |||||
name="{{ sprintf('%s',@name) }}" | |||||
value="true" | |||||
{{ is_array(@info.checked) ? in_array(@key,@info.checked) ? 'checked' : '' : !strcmp(@key,@info.checked) ? 'checked' : '' }} /> | |||||
<label for="{{ sprintf('%s-%s',@name,@key) }}"> | |||||
{{ @val }}</label> | |||||
</repeat> | |||||
<br> | |||||
</true> | |||||
</check> | |||||
</repeat> | |||||
<button type="submit" >{{ @submit_text ? : 'save' }}</button> | |||||
</form> |
GET /@level1/@level2 = Controller\Page->secondLevel | GET /@level1/@level2 = Controller\Page->secondLevel | ||||
GET /@level1/@level2/@level3 = Controller\Page->thirdLevel | GET /@level1/@level2/@level3 = Controller\Page->thirdLevel | ||||
GET /@level1/@level2/@level3/@level4 = Controller\Page->fourthLevel | GET /@level1/@level2/@level3/@level4 = Controller\Page->fourthLevel | ||||
POST /email = Controller\Email->send |