summaryrefslogtreecommitdiff
path: root/modules/path/path.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-10-01 05:18:03 +0000
committerDries Buytaert <dries@buytaert.net>2003-10-01 05:18:03 +0000
commitfa2581edcfa52c847db93a9421de5216fb0072f6 (patch)
tree157fe17cb4af14b4b927ce157c29ab8fd9b894cf /modules/path/path.module
parent392304da5f4a6f86d8ab8b5f91d38a698d1dcc88 (diff)
downloadbrdo-fa2581edcfa52c847db93a9421de5216fb0072f6.tar.gz
brdo-fa2581edcfa52c847db93a9421de5216fb0072f6.tar.bz2
- Modifies path.module to get rid of pgsql reserved word. Patch by Adrian.
- Updates database.pgsql and database.mysql to work with current cvs. Patch by Adrian. - Updates update.php to be able to update postgres from 4.2 to current. Patch by Adrian. - Small fixes by me.
Diffstat (limited to 'modules/path/path.module')
-rw-r--r--modules/path/path.module56
1 files changed, 28 insertions, 28 deletions
diff --git a/modules/path/path.module b/modules/path/path.module
index df599eb68..fdd597d9b 100644
--- a/modules/path/path.module
+++ b/modules/path/path.module
@@ -23,7 +23,7 @@ function path_admin() {
case t("delete"):
if ($edit["confirm"]) {
if (path_delete($edit['pid'])) {
- $output .= status("Deleted path '". $edit['new'] ."'");
+ $output .= status("Deleted path '". $edit['dst'] ."'");
}
}
else {
@@ -36,7 +36,7 @@ function path_admin() {
// fall-through
default:
- $output = path_overview();
+ $output .= path_overview();
}
return $output;
@@ -85,12 +85,12 @@ function path_confirm_delete($id) {
$form .= form_hidden("confirm", 1);
$form .= form_hidden("pid", $id);
- $form .= form_hidden("old", $path->old);
- $form .= form_hidden("new", $path->new);
+ $form .= form_hidden("src", $path->src);
+ $form .= form_hidden("dst", $path->dst);
$form .= form_submit(t("Delete"));
$form .= form_submit(t("Cancel"));
- return form(form_item(t("Delete alias '%new' that maps to '%old'", array("%new" => $path->new, "%old" => $path->old)), $form, t("Are you sure you want to delete this alias?")));
+ return form(form_item(t("Delete alias '%dst' that maps to '%src'", array("%dst" => $path->dst, "%src" => $path->src)), $form, t("Are you sure you want to delete this alias?")));
}
function path_delete($pid) {
@@ -114,8 +114,8 @@ function path_help($section = "admin/path/help") {
}
function path_form($edit = "") {
- $form .= form_textfield(t("Existing path"), "old", $edit["old"], 50, 64, t("Specify the existing path you wish to alias. For example: node/view/28, forum/1, taxonomy/page/or/1,2."));
- $form .= form_textfield(t("New path alias"), "new", $edit["new"], 50, 64, t("Specify an alternative path by which this data can be accessed. For example, type 'about' when writing an about page."));
+ $form .= form_textfield(t("Existing path"), "src", $edit["src"], 50, 64, t("Specify the existing path you wish to alias. For example: node/view/28, forum/1, taxonomy/page/or/1,2."));
+ $form .= form_textfield(t("New path alias"), "dst", $edit["dst"], 50, 64, t("Specify an alternative path by which this data can be accessed. For example, type 'about' when writing an about page."));
$form .= form_hidden("pid", $edit["pid"]);
$form .= form_submit(t("Create new alias"));
@@ -127,15 +127,15 @@ function path_form($edit = "") {
}
function path_insert($edit) {
- return db_query("INSERT INTO {path} SET old = '%s', new = '%s'", $edit["old"], $edit["new"]);
+ return db_query("INSERT INTO {path} SET src = '%s', dst = '%s'", $edit["src"], $edit["dst"]);
}
# DELETE
function path_is_unique($path, $type) {
- if ($type == "new") {
- return !(get_old_url($path));
+ if ($type == "dst") {
+ return !(get_src_url($path));
}
- elseif ($type == "old") {
+ elseif ($type == "src") {
return !(get_url_alias($path));
}
}
@@ -154,15 +154,15 @@ function path_perm() {
function path_overview() {
$sql = "SELECT * FROM {path}";
$header = array(
- array ("data" => t("alias"), "field" => "new", "sort" => "asc"),
- array ("data" => t("maps to"), "field" => "old"),
+ array ("data" => t("alias"), "field" => "dst", "sort" => "asc"),
+ array ("data" => t("maps to"), "field" => "src"),
array("data" => t("operations"), "colspan" => 2)
);
$sql .= tablesort_sql($header);
$result = pager_query($sql, 50);
while ($data = db_fetch_object($result)) {
- $rows[] = array($data->new, $data->old, l(t("edit"), "admin/path/edit/$data->pid"), l(t("delete"), "admin/path/delete/$data->pid"));
+ $rows[] = array($data->dst, $data->src, l(t("edit"), "admin/path/edit/$data->pid"), l(t("delete"), "admin/path/delete/$data->pid"));
}
$pager = pager_display(NULL, 50, 0, "admin", tablesort_pager());
@@ -174,33 +174,33 @@ function path_overview() {
}
function path_save($edit) {
- $new = path_clean($edit["new"]);
- $old = path_clean($edit["old"]);
+ $dst = path_clean($edit["dst"]);
+ $src = path_clean($edit["src"]);
- if ($old == NULL || !valid_url($old)) {
- return t("The specified path is not valid.");
+ if ($src == NULL || !valid_url($src)) {
+ return t("the specified path is not valid.");
}
- if (db_result(db_query("SELECT COUNT(old) FROM {path} WHERE old = '%s'", $old))) {
- return t("The specified path is already aliased.");
+ if (db_result(db_query("SELECT COUNT(src) FROM {path} WHERE src = '%s'", $src))) {
+ return t("the specified path is already aliased.");
}
- if ($new == NULL || !valid_url($new)) {
- return t("The specified path alias is not valid.");
+ if ($dst == NULL || !valid_url($dst)) {
+ return t("the specified path alias is not valid.");
}
- if (db_result(db_query("SELECT COUNT(new) FROM {path} WHERE new = '%s'", $new))) {
- return t("The specified alias is already in use.");
+ if (db_result(db_query("SELECT COUNT(dst) FROM {path} WHERE dst = '%s'", $dst))) {
+ return t("the specified alias is already in use.");
}
if ($edit["pid"]) {
- path_update($old, $new);
+ path_update($src, $dst);
}
else { //Update the path
path_insert($edit);
}
- return t("you may access %old via %new.", array("%old" => url($old), "%new" => l($new, url($new))));
+ return t("you may access %src via %dst.", array("%src" => url($src), "%dst" => l($dst, url($dst))));
}
function path_system($field) {
@@ -212,10 +212,10 @@ function path_system($field) {
function path_update($edit) {
if ($edit["pid"]) {
- return db_query("UPDATE {path} SET old = '%s', new = '%s' WHERE pid = '%d'", $edit["old"], $edit["new"], $edit["pid"]);
+ return db_query("UPDATE {path} SET src = '%s', dst = '%s' WHERE pid = '%d'", $edit["src"], $edit["dst"], $edit["pid"]);
}
else { // intended for nodes
- return db_query("UPDATE {path} SET new = '%s' WHERE old = '%s'", $edit["new"], $edit["old"]);
+ return db_query("UPDATE {path} SET dst = '%s' WHERE src = '%s'", $edit["dst"], $edit["src"]);
}
}