You are here

function forena_layout_form_validate in Forena Reports 7.3

Same name and namespace in other branches
  1. 6.2 forena.admin.inc \forena_layout_form_validate()
  2. 6 forena.admin.inc \forena_layout_form_validate()
  3. 7 forena.admin.inc \forena_layout_form_validate()
  4. 7.2 forena.admin.inc \forena_layout_form_validate()

File

./forena.admin.inc, line 528

Code

function forena_layout_form_validate($form, &$form_state) {
  $values = $form_state['values'];
  $body = $values['body']['value'];
  $doc_prefix = '<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE root [
    <!ENTITY nbsp "&#160;">
    ]>';
  if ($body) {
    $body_doc = new DOMDocument('1.0', 'UTF-8');
    $body_xml = $doc_prefix . '<html xmlns:frx="urn:FrxReports">' . $body . '</html>';
    if (@$body_doc
      ->loadXML($body_xml) === FALSE) {
      form_set_error('body', t('Invalid XHTML Document. Check for unclosed tags or stray &'));
    }
  }
  if ($values['menu']['path']) {
    if (!valid_url(str_replace(':', '', $values['menu']['path']), FALSE)) {
      form_set_error('menu][path', t('Invalid Path'));
    }
  }
}