Exemplo n.º 1
0
    $ari->t->assign("newName", "");
    $ari->t->assign("newNiceName", "");
} else {
    //verificar datos enviados duplicados
    if (!$sp->Validar()) {
        $ari->error->addError('seguridad_permission', 'SENT_DUPLICATE_DATA');
    }
    $permiso = new seguridad_permission();
    $permiso->set('modulename', $_POST['cboModulo']);
    $permiso->set('name', $_POST['txtName']);
    $permiso->set('nicename', $_POST['txtNiceName']);
    //stores?
    if ($permiso->store()) {
        header("Location: " . $ari->get("adminaddress") . '/seguridad/permission/new');
        exit;
    } else {
        $ari->t->assign("form", true);
        $ari->t->assign("error", true);
        $errores = $ari->error->getErrorsfor("seguridad_permission");
        foreach ($errores as $error) {
            $ari->t->assign($error, true);
        }
        //refrescar template
        $name = OOB_validatetext::inputHTML($_POST['txtName']);
        $ari->t->assign("newName", $name);
        $niceName = OOB_validatetext::inputHTML($_POST['txtNiceName']);
        $ari->t->assign("newNiceName", $niceName);
    }
}
$ari->t->assign("formElement", $sp->FormElement());
$ari->t->display($ari->module->admintpldir() . "/permission_new.tpl");
Exemplo n.º 2
0
$message = $input = '';
if (isset($_POST['testform_button'])) {
    $message = (string) ($sp->Validar() == TRUE) ? 'Input OK' : 'Data sent twice';
    $input = $_POST['testform_button'];
}
?>
<html>
	<head>
	<title>Sample</title>
	</head>
		<body>
		<p><b><?php 
echo $message;
?>
</b></p>
		<p><?php 
echo $input;
?>
</p>
	<form name="token" action="safepost_test.php" method="post">
	  	<?php 
/* automatically sets new token after old token was checked with first
  	output of form element */
echo $sp->FormElement();
?>
		<input name="teststring" type="text" value=""><br>
		<input type="submit" value="Send" name="testform_button">
		</form>
  </body>
</html>