private function _get_frm_valid() { $form = array('txt_name' => '', 'txt_phone' => '', 'txt_fax' => '', 'txt_email' => '', 'txt_address' => '', 'txt_city' => '', 'txt_zipcode' => '', 'txt_contact' => '', 'txt_state' => '', 'txt_slogan' => '', 'txt_title' => '', 'txt_keyword' => '', 'txt_description' => '', 'txt_per_test' => '', 'txt_width' => '', 'txt_height' => '', 'rdo_enable_cart' => '', 'attach_logo' => ''); $errors = $form; if ($_POST) { $post = new Validation(array_merge($_POST, $_FILES)); if (!empty($_FILES['attach_logo']['name'])) { $post->add_rules('attach_logo', 'upload::type[gif,jpg,png,jpeg]', 'upload::size[2M]'); } $post->pre_filter('trim', TRUE); $post->add_rules('txt_name', 'required'); $post->add_rules('txt_phone', 'required'); //$post->add_rules('txt_fax','phone[7,10,11,14]'); $post->add_rules('txt_email', 'required', 'email'); $post->pre_filter('trim', TRUE); $post->add_rules('txt_width', 'digit'); $post->add_rules('txt_height', 'digit'); $post->add_rules('txt_per_test', 'digit'); if ($post->validate()) { $form = arr::overwrite($form, $post->as_array()); return $form; } else { $errors = arr::overwrite($errors, $post->errors('site_validation')); $str_error = ''; foreach ($errors as $id => $name) { if ($name) { $str_error .= $name . '<br>'; } } $this->session->set_flash('error_msg', $str_error); } } url::redirect('admin_config'); die; }
public function validate(Validation $array, $save = FALSE) { // uses PHP trim() to remove whitespace from beginning and end of all fields before validation $array->pre_filter('trim'); // merge unvalidated fields, in case the subclass has set any. if (!isset($this->unvalidatedFields)) { $this->unvalidatedFields = array(); } $this->unvalidatedFields = array_merge($this->unvalidatedFields, array('validation_rules', 'public', 'multi_value', 'deleted')); $array->add_rules('caption', 'required'); $array->add_rules('data_type', 'required'); if (array_key_exists('data_type', $array->as_array()) && $array['data_type'] == 'L') { if (empty($array['termlist_id'])) { $array->add_rules('termlist_id', 'required'); } else { array_push($this->unvalidatedFields, 'termlist_id'); } } $array->add_rules('system_function', 'length[1,30]'); $parent_valid = parent::validate($array, $save); // clean up cached required fields in case validation rules have changed $cache = Cache::instance(); $cache->delete_tag('required-fields'); if ($save && $parent_valid) { // clear the cache used for attribute datatype and validation rules since the attribute has changed $cache = new Cache(); // Type is the object name with _attribute stripped from the end $type = substr($this->object_name, 0, strlen($this->object_name) - 10); $cache->delete('attrInfo_' . $type . '_' . $this->id); } return $save && $parent_valid; }
private function _get_register_valid() { $form = array('txt_email' => '', 'txt_password' => '', 'txt_cfpass' => '', 'txt_email' => '', 'txt_random' => '', 'txt_fname' => '', 'txt_lname' => '', 'txt_cpname' => '', 'txt_spname' => '', 'txt_spemail' => ''); $errors = $form; if ($_POST) { $post = new Validation($_POST); $post->pre_filter('trim', TRUE); $post->add_rules('txt_password', 'required', 'length[1,50]'); $post->add_rules('txt_cfpass', 'required', 'matches[txt_password]'); $post->add_rules('txt_email', 'required', 'email'); $post->add_rules('txt_random', 'required'); $post->add_callbacks('txt_email', array($this, '_check_email')); //$post->add_callbacks('txt_random',array($this,'_check_security_code')); if ($post->validate()) { $form = arr::overwrite($form, $post->as_array()); return $form; } else { $form = arr::overwrite($form, $post->as_array()); // Retrieve input data $this->session->set_flash('input_data', $form); // Set input data in session $errors = arr::overwrite($errors, $post->errors('register_validation')); $str_error = ''; foreach ($errors as $id => $name) { if ($name) { $str_error .= $name . '<br>'; } } $this->session->set_flash('error_msg', $str_error); url::redirect('register'); die; } } }
public function validate(Validation $array, $save = FALSE) { $array->pre_filter('trim'); $array->add_rules('term', 'required'); $array->add_rules('language_id', 'required'); return parent::validate($array, $save); }
public function validate(Validation $array, $save = FALSE) { $array->pre_filter('trim'); $array->add_rules('title', 'required'); $this->unvalidatedFields = array('code', 'abbreviation', 'description', 'category_id', 'deleted'); return parent::validate($array, $save); }
public function reset() { if ($this->owner->logged_in()) { url::redirect('/admin/testimonials/display'); } $login_shell = new View('admin/login_shell'); $login_shell->content = new View('admin/reset'); if (empty($_POST)) { die($login_shell); } $post = new Validation($_POST); $post->pre_filter('trim'); $post->add_rules('email', 'required', 'valid::email'); # if Post is good, atttempt to log owner in. if ($post->validate()) { $owner = ORM::factory('owner')->find($_POST['email']); if (!$owner->loaded) { die('email does not have an account'); } $pw = text::random('alnum', 8); $owner->password = $pw; $owner->save(); $replyto = 'unknown'; $body = "Your auto-generated password is: {$pw} \r\n" . "Change your password to something more appropriate by going here:\r\n" . "http://pluspanda.com/admin/account?old={$pw} \r\n\n" . "Thank you! - Jade from pluspanda"; # to do FIX THE HEADERS. $subject = 'Your Pluspanda Password Has Been Reset =)'; $headers = "From: noreply@pluspanda.com \r\n" . "Reply-To: Jade \r\n" . 'X-Mailer: PHP/' . phpversion(); mail($_POST['email'], $subject, $body, $headers); die('Please check your email for your new password!'); } # error $login_shell->content->alert = alerts::display(array('error' => 'Invalid Email or Password.')); $login_shell->content->values = $_POST; die($login_shell); }
private function _get_record() { $form = array('txt_name' => '', 'txt_email' => '', 'txt_phone' => '', 'txt_subject' => '', 'txt_content' => '', 'txt_code' => '', 'txt_last_name' => '', 'txt_first_name' => '', 'txt_company' => ''); $errors = $form; if ($_POST) { $post = new Validation($_POST); $post->pre_filter('trim', TRUE); $post->add_rules('txt_name', 'required'); $post->add_rules('txt_email', 'required', 'email'); $post->add_rules('txt_subject', 'required'); $post->add_rules('txt_content', 'required'); //$post->add_rules('txt_code','required'); //$post->add_callbacks('txt_random',array($this,'_check_security_code')); //$post->add_rules('sel_send','trim'); if ($post->validate()) { $form = arr::overwrite($form, $post->as_array()); return $form; } else { $form = arr::overwrite($form, $post->as_array()); // Retrieve input data $this->session->set_flash('input_data', $form); // Set input data in session $errors = arr::overwrite($errors, $post->errors('contact_validation')); $error_msg = ''; foreach ($errors as $id => $name) { if ($name) { $error_msg .= '<br>' . $name; } } $this->session->set_flash('error_msg', $error_msg); url::redirect('contact'); die; } } }
private function _get_record_aut_config() { $form = array('txt_aut_api_login' => '', 'txt_aut_transaction_key' => '', 'sel_aut_post_url' => ''); $errors = $form; if ($_POST) { $post = new Validation($_POST); $post->pre_filter('trim', TRUE); $post->add_rules('txt_aut_api_login', 'trim', 'required'); $post->add_rules('txt_aut_transaction_key', 'trim', 'required'); $post->add_rules('sel_aut_post_url', 'trim', 'required'); $form = arr::overwrite($form, $post->as_array()); $form = $this->_set_form_aut_config($form); if ($post->validate()) { return $form; } else { $this->session->set_flash('frm_aut', $form); $errors = arr::overwrite($errors, $post->errors('authorizenet_config_validation')); $str_error = ''; foreach ($errors as $id => $name) { if ($name) { $str_error .= '<br>' . $name; } } $this->session->set_flash('error_msg', $str_error); url::redirect('admin_payment_method'); die; } } }
public function create() { $this->template->content = new View('users/create'); $form = new Validation($_POST); $form->pre_filter('trim', true); $form->add_rules('username', 'required')->add_rules('password', 'required')->add_rules('email', 'required', 'valid::email'); $this->template->content->repopulate = $form; if ($form->validate()) { // Create new user $user = new User_Model(); if (!$user->username_exists($this->input->post('username'))) { foreach ($form->as_array() as $key => $val) { // Set user data $user->{$key} = $val; } if ($user->validate($form->as_array())) { if ($user->add(ORM::factory('role', 'login')) and $user->save()) { // Redirect to the login page url::redirect('login'); } } } } // Error $this->template->content->error = $form->errors('login'); }
private function pricing() { $this->shell->meta = 'Plans and pricing for testimonial and review layouts and templates for your website'; $this->shell->content = new View('marketing/testimonials/start'); $this->shell->title = 'Plans and Pricing'; if (empty($_POST)) { die($this->shell); } # handle the POST. $this->shell->content->values = $_POST; $post = new Validation($_POST); $post->pre_filter('trim'); $post->add_rules('email', 'required', 'valid::email'); $post->add_rules('password', 'required', 'matches[password2]', 'valid::alpha_dash'); if (!$post->validate()) { $this->shell->content->errors = $post->errors(); die($this->shell); } $new_owner = ORM::factory('owner'); # unique email. if (!$new_owner->email_available($_POST['email'])) { $this->shell->content->errors = 'Email Already Exists!'; die($this->shell); } $new_owner->email = $_POST['email']; $new_owner->password = $_POST['password']; $new_owner->save(); # log the user in and take to admin $this->auth->force_login($new_owner); url::redirect('/admin/login'); }
public function index() { $this->template->content = new View('admin/flickrwijit_form'); // setup and initialize form field names $form = array('flickr_tag' => '', 'flickr_id' => '', 'num_of_photos' => '', 'image_width' => '', 'image_height' => '', 'block_position' => '', 'enable_cache' => '', 'block_no_photos' => ''); // Copy the form as errors, so the errors will be stored with keys // corresponding to the form field names $errors = $form; $form_error = FALSE; $form_saved = FALSE; // check, has the form been submitted, if so, setup validation if ($_POST) { // Instantiate Validation, use $post, so we don't overwrite $_POST // fields with our own things $post = new Validation($_POST); // Add some filters $post->pre_filter('trim', TRUE); $post->add_rules('flickr_tag', 'required', 'length[0,500]'); $post->add_rules('flickr_id', 'length[0,20]'); $post->add_rules('num_of_photos', 'numeric'); $post->add_rules('image_width', 'length[2,600]', 'numeric'); $post->add_rules('image_height', 'required', 'length[2,600]', 'numeric'); $post->add_rules('block_position', 'length[1,6]', 'numeric'); $post->add_rules('enable_cache', 'between[0,1]', 'numeric'); $post->add_rules('block_no_photos', 'between[4,10]', 'numeric'); // passed validation test. if ($post->validate()) { $flickrwijit_settings = new Flickrwijit_Model(1); $flickrwijit_settings->flickr_tag = $post->flickr_tag; $flickrwijit_settings->flickr_id = $post->flickr_id; $flickrwijit_settings->num_of_photos = $post->num_of_photos; $flickrwijit_settings->image_height = $post->image_height; $flickrwijit_settings->image_width = $post->image_width; $flickrwijit_settings->block_position = $post->block_position; $flickrwijit_settings->enable_cache = $post->enable_cache; $flickrwijit_settings->block_no_photos = $post->block_no_photos; $flickrwijit_settings->save(); // Delete Settings Cache // $this->cache->delete('settings'); // $this->cache->delete_tag('settings'); // Everything is A-Okay! $form_saved = TRUE; // repopulate the form fields $form = arr::overwrite($form, $post->as_array()); } else { // repopulate the form fields $form = arr::overwrite($form, $post->as_array()); // populate the error fields, if any $errors = arr::overwrite($errors, $post->errors('flickrwijit')); $form_error = TRUE; } } else { $flickrwijit_settings = ORM::factory('flickrwijit', 1); $form = array('flickr_tag' => $flickrwijit_settings->flickr_tag, 'flickr_id' => $flickrwijit_settings->flickr_id, 'num_of_photos' => $flickrwijit_settings->num_of_photos, 'image_width' => $flickrwijit_settings->image_width, 'image_height' => $flickrwijit_settings->image_height, 'block_position' => $flickrwijit_settings->block_position, 'enable_cache' => $flickrwijit_settings->enable_cache, 'block_no_photos' => $flickrwijit_settings->block_no_photos); } $this->template->content->form = $form; $this->template->content->errors = $errors; $this->template->content->form_error = $form_error; $this->template->content->form_saved = $form_saved; }
private function form_handler($page_name, $newsletter) { $view = new View('public_newsletter/newsletters/form'); $view->page_name = $page_name; $values = array('name' => '', 'email' => ''); $view->values = $values; if ($_POST) { $post = new Validation($_POST); $post->pre_filter('trim'); $post->add_rules('name', 'required'); $post->add_rules('email', 'required', 'valid::email'); if (!$post->validate()) { $view->errors = arr::overwrite($values, $post->errors('form_error_messages')); $view->values = arr::overwrite($values, $post->as_array()); return $view; } include Kohana::find_file('vendor', 'CMBase'); $cm = new CampaignMonitor(null, null, $newsletter->cm_list_id); $result = $cm->subscriberAdd($_POST['email'], $_POST['name']); if ($result['Result']['Code'] != 0) { kohana::log('error', $result['Result']['Message']); return 'There was an error adding you to the emailing list. Please try again later.'; } return 'Thank you! You have been adding to our mailing list.'; } return $view; }
public function validate(Validation $array, $save = FALSE) { $array->pre_filter('trim'); $array->add_rules('taxon_group_id', 'required'); $array->add_rules('taxon_list_id', 'required'); return parent::validate($array, $save); }
public function add() { $argumentarray = Router::$arguments; //$id = $argumentarray[0]; if (isset($_POST['save'])) { $post = new Validation(array_merge($_POST, $_FILES)); $post->pre_filter('trim', 'foilName', 'foilHexcode'); $post->add_rules('foilName', 'required'); $post->add_rules('foilHexcode', 'required'); if (!$post->validate()) { $errors = $post->errors('form_errors'); foreach ($errors as $error) { echo '<p class="error">' . $error . '</p>'; } } else { //$id = $argumentarray[0]; $foils = new Foil_Color_Model(); $foil = ORM::factory('foil_color'); $foil->name = $post->foilName; $foil->hexcode = $post->foilHexcode; try { $foil->save(); $foils = new Foil_Color_Model(); $id = $foils->getNextID(); url::redirect('/foils/edit/' . $foil->id); } catch (Exception $ex) { echo 'There was an error adding this foil: ' . $ex->getMessage(); //url::redirect('/foils/'); } } } $this->_renderView(); }
private function post_review($page_name, $review_id) { # validate the form values. $post = new Validation($_POST); $post->pre_filter('trim'); $post->add_rules('body', 'required'); $post->add_rules('name', 'required'); $post->add_rules('email', 'required'); # on error if (!$post->validate()) { $view = new View('public_review/reviews/add_form'); $view->page_name = $page_name; $view->errors = $post->errors(); $view->values = $_POST; return $view; } # on success $new_item = ORM::factory('review_item'); $new_item->review_id = $review_id; $new_item->fk_site = $this->site_id; $new_item->body = $_POST['body']; $new_item->rating = $_POST['rating']; $new_item->name = $_POST['name']; $new_item->save(); $view = new View('public_review/reviews/status'); $view->success = true; return $view; }
public function validate(Validation $array, $save = FALSE) { // uses PHP trim() to remove whitespace from beginning and end of all fields before validation $array->pre_filter('trim'); $this->unvalidatedFields = array('user_id', 'website_id', 'site_role_id'); return parent::validate($array, $save); }
public function edit() { if (isset($_POST['save'])) { $post = new Validation(array_merge($_POST, $_FILES)); //******** TO DO: trim for shipping info **************/ $post->pre_filter('trim', 'msg_text1', 'designpath', 'img_approved'); $post->add_rules('msg_text1', 'required'); $post->add_rules('designpath', 'required', 'numeric'); $post->add_rules('img_approved', 'numeric'); if (!$post->validate()) { $errors = $post->errors('form_errors'); foreach ($errors as $error) { echo '<p class="error">' . $error . '</p>'; } } else { $id = $this->uri->segment(3); $basket = ORM::factory('orders_basket')->find($id); $basket->msg_text1 = $post->msg_text1; $basket->designpath = $post->designpath; $basket->img_approved = $post->img_approved; $basket->save(); /*************** TO DO: delete more than one category ****************/ } } $this->_renderView(); }
/** * Show latest PER_PAGE news on page * @return void */ public function index($module = NULL, $page = 1) { $this->set_title(Kohana::lang('search.search')); if ($page == 1) { $this->add_breadcrumb(Kohana::lang('search.the_best_results'), url::current()); } else { $this->add_breadcrumb(Kohana::lang('search.page_no') . ' ' . $page, url::current()); } // Default values $form = array('value' => ''); $errors = array(); if ($_POST) { $post = new Validation($_POST); // Some filters $post->pre_filter('trim', TRUE); // Rules $post->add_rules('value', 'required'); if ($post->validate()) { $form = arr::overwrite($form, $post->as_array()); } else { // Repopulate form with error and original values $form = arr::overwrite($form, $post->as_array()); $errors = $post->errors('search_errors'); } } $this->template->content = new View('search'); $data = $this->products->search($post['value']); $data2 = $this->page->search($post['value']); $data3 = $this->news->search($post['value']); $this->template->content->data = $data; $this->template->content->data2 = $data2; $this->template->content->data3 = $data3; $this->template->content->form = $form; $this->template->content->errors = $errors; }
public function validate(Validation $array, $save = FALSE) { // uses PHP trim() to remove whitespace from beginning and end of all fields before validation $array->pre_filter('trim'); $this->unvalidatedFields = array('survey_attribute_id', 'website_id', 'default_text_value', 'default_float_value', 'default_int_value', 'default_date_start_value', 'default_date_end_value', 'default_date_type_value', 'control_type_id'); return parent::validate($array, $save, array()); }
public function add() { if (isset($_POST['save'])) { $post = new Validation(array_merge($_POST, $_FILES)); $post->pre_filter('trim', 'typeName', 'typeDescription', 'typeShortDescription', 'metaTitle', 'metaDescription', 'metaKeywords'); $post->add_rules('typeName', 'required'); if (!$post->validate()) { $errors = $post->errors('form_errors'); foreach ($errors as $error) { echo '<p class="error">' . $error . '</p>'; } } else { $id = $this->uri->segment(3); $type = ORM::factory('products_type')->find($id); $type->name = $post->typeName; $type->category_id = $post->category; $type_desc = ORM::factory('products_types_description')->where('id', $type->products_types_description_id)->find(); $type_desc->short_description = $post->typeShortDescription; $type_desc->description = $post->typeDescription; $type_desc->meta_title = $post->metaTitle; $type_desc->meta_description = $post->metaDescription; $type_desc->meta_keywords = $post->metaKeywords; $type_desc->title_url = $post->metaUrl; $type_desc->image_alt = $post->image_alt; $type_desc->video = $post->video; if (!empty($_FILES['image']['name'])) { // uses Kohana upload helper $_FILES = Validation::factory($_FILES)->add_rules('image', 'upload::valid', 'upload::type[gif,jpg,jpeg,png]', 'upload::size[2M]'); if ($_FILES->validate()) { // Temporary file name $filename = upload::save('image', basename($_FILES['image']['tmp_name'])); $file = basename($_FILES['image']['name']); // Resize, sharpen, and save the image Image::factory($filename)->save(DOCROOT . '../../env/product_type_images/' . $file); // Remove the temporary file unlink($filename); $type_desc->image = $file; $type_desc->save(); } else { $errors = $_FILES->errors('form_user'); } } $type_desc->save(); $type->products_types_description_id = $type_desc->id; $type->save(); if (!empty($post->productTypeSites)) { foreach ($post->productTypeSites as $site_id) { $sc = ORM::factory('sites_types')->where('products_type_id', $type->id)->where('site_id', $site_id)->find(); if ($sc->id == 0) { $sc->products_type_id = $type->id; $sc->site_id = $site_id; $sc->save(); } } } url::redirect(url::base() . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/' . $type->id); } } $this->_renderView(); }
public function password_validate(Validation $array, $save = FALSE) { $array->pre_filter('trim'); $array->add_rules('password', 'required', 'length[7,30]', 'matches[password2]'); $this->forgotten_password_key = NULL; return parent::validate($array, $save); }
public function index() { if ($this->auth->logged_in()) { $this->template->title = 'Already Logged In'; $this->template->content = new View('login/login_message'); $this->template->content->message = 'You are already logged in.<br />'; $this->template->content->link_to_home = 'YES'; $this->template->content->link_to_logout = 'YES'; return; } $this->template->title = 'Forgotten Password Email Request'; $this->template->content = new View('login/forgotten_password'); if (request::method() == 'post') { $post = new Validation($_POST); $post->pre_filter('trim', TRUE); $post->add_rules('UserID', 'required'); $returned = $this->auth->user_and_person_by_username_or_email($_POST['UserID']); if (array_key_exists('error_message', $returned)) { $this->template->content->error_message = $returned['error_message']; return; } $user = $returned['user']; $person = $returned['person']; if (!$this->check_can_login($user)) { return; } $this->auth->send_forgotten_password_mail($user, $person); $this->template->title = 'Email Sent'; $this->template->content = new View('login/login_message'); $this->template->content->message = 'An email providing a link which will allow your password to be reset has been sent to the specified email address, or if a username was provided, to the registered email address for that user.<br />'; } }
public function add() { $form = array('building_id' => '', 'name' => '', 'index' => '', 'img_uri' => '', 'active' => ''); $errors = $form; if ($_POST) { $post = new Validation($_POST); $post->pre_filter('trim', true); $post->add_rules('buildings_id', 'required', 'digit'); $post->add_rules('name', 'required'); $post->add_rules('index', 'required'); $post->add_rules('img_uri', 'required'); $post->add_rules('active', 'required'); if ($post->validate()) { // check for invilid $form = arr::overwrite($form, $post->as_array()); $people = new Person_Model(); $result = $people->save($this->input->get('person'), $person_id); } else { $form = arr::overwrite($form, $post->as_array()); client::validation_results(arr::overwrite($errors, $post->errors('hiring_employee_form_validations'))); client::messageSend("There were errors in some fields", E_USER_WARNING); } } $building = new Building_Model(); $buildings_list = $building->select_list(); $this->template->title = 'Seating::Spaces::Add'; $this->template->content = new View('pages/spaces_add'); $this->template->content->form = $form; $this->template->content->buildings_list = $buildings_list; }
private function _get_frm_valid() { $hd_id = $this->input->post('hd_id'); $form = $this->data_template_model->get_frm(); $errors = $form; if ($_POST) { $post = new Validation($_POST); $post->pre_filter('trim', TRUE); $post->add_rules('txt_name', 'required', 'length[1,200]'); $post->add_rules('txt_content', 'required'); if ($post->validate()) { $form = arr::overwrite($form, $post->as_array()); return $form; } else { $form = arr::overwrite($form, $post->as_array()); $errors = arr::overwrite($errors, $post->errors('account_validation')); $str_error = ''; foreach ($errors as $id => $name) { if ($name) { $str_error .= $name . '<br>'; } } $this->session->set_flash('error_msg', $str_error); if ($hd_id) { url::redirect('admin_emailtemplate/edit/' . $hd_id); } die; } } }
private function _get_valid_accinfo($old_pass) { $form = array('txt_old_pass' => '', 'txt_new_pass' => '', 'txt_cf_new_pass' => '', 'txt_email' => ''); $errors = $form; if ($_POST) { $post = new Validation($_POST); $post->pre_filter('trim', TRUE); if (!empty($old_pass)) { $post->add_rules('txt_new_pass', 'required', 'length[6,50]'); $post->add_rules('txt_cf_new_pass', 'matches[txt_new_pass]'); $post->add_callbacks('txt_old_pass', array($this, '_check_old_pass')); } $post->add_rules('txt_email', 'required', 'email'); $post->add_callbacks('txt_email', array($this, '_check_email')); if ($post->validate()) { $form = arr::overwrite($form, $post->as_array()); return $form; } else { $form = arr::overwrite($form, $post->as_array()); $this->session->set_flash('input_data', $form); $errors = arr::overwrite($errors, $post->errors('account_validation')); $str_error = ''; foreach ($errors as $id => $name) { if ($name) { $str_error .= $name . '<br>'; } } $this->session->set_flash('error_msg', $str_error); url::redirect($this->uri->segment(1)); die; } } }
public function validate(Validation $array, $save = FALSE) { $array->pre_filter('trim'); $array->add_rules('title', 'required'); // Explicitly add those fields for which we don't do validation $this->unvalidatedFields = array('description', 'website_id', 'parent_id', 'deleted'); return parent::validate($array, $save); }
public function validate(Validation $array, $save = false) { $array->pre_filter('trim'); $array->add_rules('taxon_meaning_id', 'required'); $array->add_rules('path', 'required'); $this->unvalidatedFields = array('caption', 'external_details', 'media_type_id'); return parent::validate($array, $save); }
public function validate(Validation $array, $save = FALSE) { $array->pre_filter('trim'); $array->add_rules('title', 'required'); $array->add_rules('website_id', 'required'); $this->unvalidatedFields = array('description', 'deleted', 'parent_id', 'owner_id', 'auto_accept', 'auto_accept_max_difficulty'); return parent::validate($array, $save); }
public function validate(Validation $array, $save = FALSE) { // uses PHP trim() to remove whitespace from beginning and end of all fields before validation $array->pre_filter('trim'); $array->add_rules('title', 'required', 'length[1,10]'); $this->unvalidatedFields = array('deleted'); return parent::validate($array, $save); }
public function validate(Validation $array, $save = FALSE) { $array->pre_filter('trim'); $array->add_rules('taxon_id', 'required'); $array->add_rules('taxon_designation_id', 'required'); $this->unvalidatedFields = array('start_date', 'source', 'geographical_constraint', 'deleted'); return parent::validate($array, $save); }