You are here

function og_panels_form_validate in Organic groups 6

Same name and namespace in other branches
  1. 5.8 og_panels.module \og_panels_form_validate()
  2. 5 og_panels.module \og_panels_form_validate()
  3. 5.3 og_panels.module \og_panels_form_validate()
  4. 5.7 og_panels.module \og_panels_form_validate()

File

modules/og_panels/og_panels.module, line 418

Code

function og_panels_form_validate($form_id, $form_values, $form) {
  $pathblacklist = array(
    'view',
    'edit',
    'delete',
    'outline',
    'load',
    'render',
    'clone',
  );
  if (in_array($form_values['path'], $pathblacklist)) {
    form_error($form['path'], t('%path is a reserved system path, and cannot be used for a group page. Please enter another path.', array(
      '%path' => $form_values['path'],
    )));
  }
  else {
    if (preg_match("/[^A-Za-z0-9-]/", $form_values['path'])) {
      form_error($form['path'], t('Panel paths may only contain alphanumeric characters and dashes.'));
    }
    else {
      if (db_result(db_query("SELECT path FROM {og_panels} WHERE path = '%s' AND did <> %d AND nid = %d", $form_values['path'], $form_values['did'], $form_values['nid']))) {
        form_error($form['path'], t("That path is currently in use by another one of your group's pages. Please enter another path."));
      }
    }
  }
}