function grab() { $http_vars = $this->get_request(); if (isset($http_vars[$this->name])) { $val = tidy($http_vars[$this->name]); if (empty($val)) { $tidy_err = tidy_err($http_vars[$this->name]); if (!empty($tidy_err)) { $tidy_err = nl2br(htmlentities($tidy_err, ENT_QUOTES, 'UTF-8')); $this->set_error('Your HTML appears to be ill-formatted. Here is what Tidy has to say about it: <br />' . $tidy_err); $this->set($http_vars[$this->name]); } else { $this->set($val); } } else { // this looks like a hack. We could look into removing it. // $val = eregi_replace("</table>\n\n<br />\n<br />\n","</table>\n", $val); $this->set($val); } } $length = strlen($this->value); if ($this->db_type == 'tinytext' and $length > 255 or $this->db_type == 'text' and $length > 65535 or $this->db_type == 'mediumtext' and $length > 16777215) { $this->set_error('There is more text in ' . $this->display_name . ' than can be stored '); } }
function run_error_checks() { if($this->get_value('tarbaby')) { $this->set_error('tarbaby','The Not Content field must be left empty for your post to work'); } $fields_to_tidy = array('post_content','description'); foreach($fields_to_tidy as $field) { if($this->get_value($field)) { $tidied = trim(tidy($this->get_value($field))); if(empty($tidied) && in_array($field,$this->required)) { if(!empty($this->elements[$field]['display_name'])) { $display_name = $this->elements[$field]['display_name']; } else { $display_name = prettify_string($field); } $this->set_error($field,'Please fill in the '.$display_name.' field'); } else { $tidy_errors = tidy_err($this->get_value($field)); if(!empty($tidy_errors)) { $msg = 'The html in the '.$field.' field is misformed. Here is what the html checker has to say:<ul>'; foreach($tidy_errors as $tidy_error) { $msg .= '<li>'.$tidy_error.'</li>'; } $msg .= '</ul>'; $this->set_error($field,$msg); } } } } }
function run_error_checks() { foreach($this->forbidden as $field) { if($this->get_value($field)) { $this->set_error($field,'This field must be left empty for your comment to work'); } } $content = $this->get_value('comment_content'); $content = str_replace(' ', ' ', $content); if (carl_empty_html(trim(tidy($content)))) { $this->set_error('comment_content', 'You must write a comment in order to post a comment!'); } $fields_to_tidy = array('comment_content'); foreach($fields_to_tidy as $field) { if($this->get_value($field)) { $tidied = trim(tidy($this->get_value($field))); if(empty($tidied) && in_array($field,$this->required)) { if(!empty($this->elements[$field]['display_name'])) { $display_name = $this->elements[$field]['display_name']; } else { $display_name = prettify_string($field); } $this->set_error($field,'Please fill in the '.$display_name.' field'); } else { $tidy_errors = tidy_err($this->get_value($field)); if(!empty($tidy_errors)) { $msg = 'The html in the '.$field.' field is misformed. Here is what the html checker has to say:<ul>'; foreach($tidy_errors as $tidy_error) { $msg .= '<li>'.$tidy_error.'</li>'; } $msg .= '</ul>'; $this->set_error($field,$msg); } } } } if (!reason_check_authentication()) { if ($this->is_comment_spam()) { $this->set_error('comment_content', 'Your comment was rejected because it appears to be spam.'); } } }