コード例 #1
0
ファイル: AdminCtrl.php プロジェクト: DiegoVI/virtuagora
 public function adminAjustes()
 {
     $vdt = new Validate\Validator();
     $vdt->addRule('tos', new Validate\Rule\MinLength(8))->addRule('tos', new Validate\Rule\MaxLength(8192))->addFilter('tos', FilterFactory::escapeHTML());
     $req = $this->request;
     if (!$vdt->validate($req->post())) {
         throw new TurnbackException($vdt->getErrors());
     }
     $ajustes = Ajuste::all();
     foreach ($ajustes as $ajuste) {
         $newValue = $vdt->getData($ajuste->key);
         if (isset($newValue)) {
             $ajuste->value = $newValue;
             $ajuste->save();
             AdminlogCtrl::createLog('', 1, 'mod', $this->session->user('id'), $ajuste);
         }
     }
     $this->flash('success', 'Los ajustes se han modificado exitosamente.');
     $this->redirectTo('shwAdmAjuste');
 }
コード例 #2
0
 private function validarPropuesta($data)
 {
     $vdt = new Validate\Validator();
     $vdt->addRule('titulo', new Validate\Rule\MinLength(8))->addRule('titulo', new Validate\Rule\MaxLength(128))->addRule('categoria', new Validate\Rule\NumNatural())->addRule('categoria', new Validate\Rule\Exists('categorias'))->addRule('referido', new Validate\Rule\NumNatural())->addRule('cuerpo', new Validate\Rule\MinLength(8))->addRule('cuerpo', new Validate\Rule\MaxLength(8192))->addFilter('cuerpo', FilterFactory::escapeHTML())->addFilter('referido', FilterFactory::emptyToNull())->addFilter('tags', FilterFactory::explode(','))->addOptional('referido');
     if (!$vdt->validate($data)) {
         throw new TurnbackException($vdt->getErrors());
     }
     return $vdt;
 }
コード例 #3
0
 private function validarDocumento($data, $cuerpo = true)
 {
     $vdt = new Validate\Validator();
     $vdt->addRule('titulo', new Validate\Rule\MinLength(8))->addRule('titulo', new Validate\Rule\MaxLength(128))->addRule('descripcion', new Validate\Rule\MinLength(8))->addRule('descripcion', new Validate\Rule\MaxLength(1024))->addRule('categoria', new Validate\Rule\NumNatural())->addRule('categoria', new Validate\Rule\Exists('categorias'))->addFilter('tags', FilterFactory::explode(','));
     if ($cuerpo) {
         $vdt->addRule('cuerpo', new Validate\Rule\MinLength(8))->addRule('cuerpo', new Validate\Rule\MaxLength(8192))->addFilter('cuerpo', FilterFactory::escapeHTML());
     }
     if (!$vdt->validate($data)) {
         throw new TurnbackException($vdt->getErrors());
     }
     return $vdt;
 }
コード例 #4
0
ファイル: EventoCtrl.php プロジェクト: DiegoVI/virtuagora
 private function validarEvento($data)
 {
     $vdt = new Validate\Validator();
     $vdt->addRule('titulo', new Validate\Rule\MinLength(8))->addRule('titulo', new Validate\Rule\MaxLength(128))->addRule('categoria', new Validate\Rule\NumNatural())->addRule('categoria', new Validate\Rule\Exists('categorias'))->addRule('lugar', new Validate\Rule\MinLength(4))->addRule('lugar', new Validate\Rule\MaxLength(128))->addRule('fecha', new Validate\Rule\Date('Y-m-d H:i:s'))->addRule('tags', new Validate\Rule\Required())->addRule('cuerpo', new Validate\Rule\MinLength(8))->addRule('cuerpo', new Validate\Rule\MaxLength(8192))->addFilter('cuerpo', FilterFactory::escapeHTML())->addFilter('asociar', FilterFactory::booleanFilter())->addFilter('tags', FilterFactory::explode(','));
     if (!$vdt->validate($data)) {
         throw new TurnbackException($vdt->getErrors());
     }
     return $vdt;
 }