Contributions API

path_redirect_save

Definition

path_redirect_save($edit)
contributions/path_redirect/path_redirect.module, line 123

Code

<?php
function path_redirect_save($edit) {
  if (empty($edit['type'])) {
    $edit['type'] = PATH_REDIRECT_DEFAULT_TYPE;
  }
  if (empty($edit['query'])) {
    $edit['query'] = '';
  }
  if (empty($edit['fragment'])) {
    $edit['fragment'] = '';
  }

  if (!empty($edit['rid'])) {
    $return = db_query("UPDATE {path_redirect} SET path = '%s', redirect = '%s', query = '%s', fragment = '%s', type = %d WHERE rid = %d", $edit['path'], $edit['redirect'], $edit['query'], $edit['fragment'], $edit['type'], $edit['rid']);
  }
  else {
    $return = db_query("INSERT INTO {path_redirect} (path, redirect, query, fragment, type) VALUES ('%s', '%s', '%s', '%s', '%s')", $edit['path'], $edit['redirect'], $edit['query'], $edit['fragment'], $edit['type']);
  }
  return $return;
}
?>