- Bugfix: fixed two problems with adding and deleting access rules. Patch by
Moshe. Requires database upgrade.4.3.x
parent
17e92817c5
commit
7f09419564
|
@ -1296,8 +1296,9 @@ function user_admin_access($edit = array()) {
|
|||
}
|
||||
|
||||
if ($op == t("Add rule")) {
|
||||
db_query("INSERT INTO {access} (mask, type, status) VALUES ('%s', '%s', %d)", $edit["mask"], $type, $edit["status"]);
|
||||
$output .= status(t("Access rule added"));
|
||||
$aid = db_next_id("access_aid");
|
||||
db_query("INSERT INTO {access} (aid, mask, type, status) VALUES ('%s', '%s', '%s', %d)", $aid, $edit["mask"], $type, $edit["status"]);
|
||||
$output .= status(t("access rule added."));
|
||||
}
|
||||
else if ($op == t("Check")) {
|
||||
if (user_deny($type, $edit["test"])) {
|
||||
|
@ -1309,7 +1310,7 @@ function user_admin_access($edit = array()) {
|
|||
}
|
||||
else if ($id) {
|
||||
db_query("DELETE FROM {access} WHERE aid = %d", $id);
|
||||
$output .= status(t("Access rule deleted"));
|
||||
$output .= status(t("access rule deleted."));
|
||||
}
|
||||
|
||||
$header = array(t("type"), t("mask"), t("operations"));
|
||||
|
@ -1335,7 +1336,7 @@ function user_admin_access($edit = array()) {
|
|||
else {
|
||||
$title = t("Check username");
|
||||
}
|
||||
$output .= form_textfield($title, "mask", $edit["test"], 32, 64). form_submit(t("Check"));
|
||||
$output .= form_textfield($title, "test", $edit["test"], 32, 64). form_submit(t("Check"));
|
||||
|
||||
return form($output);
|
||||
}
|
||||
|
|
|
@ -1296,8 +1296,9 @@ function user_admin_access($edit = array()) {
|
|||
}
|
||||
|
||||
if ($op == t("Add rule")) {
|
||||
db_query("INSERT INTO {access} (mask, type, status) VALUES ('%s', '%s', %d)", $edit["mask"], $type, $edit["status"]);
|
||||
$output .= status(t("Access rule added"));
|
||||
$aid = db_next_id("access_aid");
|
||||
db_query("INSERT INTO {access} (aid, mask, type, status) VALUES ('%s', '%s', '%s', %d)", $aid, $edit["mask"], $type, $edit["status"]);
|
||||
$output .= status(t("access rule added."));
|
||||
}
|
||||
else if ($op == t("Check")) {
|
||||
if (user_deny($type, $edit["test"])) {
|
||||
|
@ -1309,7 +1310,7 @@ function user_admin_access($edit = array()) {
|
|||
}
|
||||
else if ($id) {
|
||||
db_query("DELETE FROM {access} WHERE aid = %d", $id);
|
||||
$output .= status(t("Access rule deleted"));
|
||||
$output .= status(t("access rule deleted."));
|
||||
}
|
||||
|
||||
$header = array(t("type"), t("mask"), t("operations"));
|
||||
|
@ -1335,7 +1336,7 @@ function user_admin_access($edit = array()) {
|
|||
else {
|
||||
$title = t("Check username");
|
||||
}
|
||||
$output .= form_textfield($title, "mask", $edit["test"], 32, 64). form_submit(t("Check"));
|
||||
$output .= form_textfield($title, "test", $edit["test"], 32, 64). form_submit(t("Check"));
|
||||
|
||||
return form($output);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,8 @@ $mysql_updates = array(
|
|||
"2003-09-10" => "update_64",
|
||||
"2003-09-29" => "update_65",
|
||||
"2003-09-30" => "update_66",
|
||||
"2003-10-11" => "update_67"
|
||||
"2003-10-11" => "update_67",
|
||||
"2003-10-20" => "update_68"
|
||||
);
|
||||
|
||||
function update_32() {
|
||||
|
@ -507,6 +508,12 @@ function update_67() {
|
|||
update_sql("ALTER TABLE users DROP homepage");
|
||||
}
|
||||
|
||||
function update_68() {
|
||||
$max = db_result(db_query("SELECT MAX(aid) FROM {access};"));
|
||||
update_sql("INSERT INTO {sequences} (name, id) VALUES ('access_aid', '$max')");
|
||||
update_sql("ALTER TABLE access CHANGE aid aid tinyint(10) NOT NULL ");
|
||||
}
|
||||
|
||||
/*
|
||||
** System functions
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue