Skip to content
Snippets Groups Projects
Commit d1a07a2e authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- fixed "you-have-to-logout-and-login-before-permissions-change" bug
  (reported by UnConeD)
- added "add node" link to book selection box and made it display the
  current location
- removed tabs and whitespaces from themes - done automatically
parent d9e72f37
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -45,6 +45,7 @@ function module($name, $module) { ...@@ -45,6 +45,7 @@ function module($name, $module) {
<?php <?php
} }
user_rehash();
admin_page($mod); admin_page($mod);
?> ?>
\ No newline at end of file
...@@ -146,10 +146,10 @@ function visit(site) { ...@@ -146,10 +146,10 @@ function visit(site) {
</SCRIPT> </SCRIPT>
<?php <?php
$choices = array("node.php?id=$node->nid" => t("view node"), "/submit.php?mod=$node->type&op=update&id=$node->nid" => t("suggest update"), "node.php?op=history&id=$node->nid" => t("view history")); $choices = array("node.php?id=$node->nid" => t("view node"), "submit.php?mod=$node->type" => t("add node"), "submit.php?mod=$node->type&op=update&id=$node->nid" => t("update node"), "node.php?op=history&id=$node->nid" => t("view history"));
$output .= "<FORM METHOD=\"get\" ACTION=\"\">\n"; $output .= "<FORM METHOD=\"get\" ACTION=\"\">\n";
foreach ($choices as $key => $value) $options .= "<OPTION VALUE=\"$key\"". ($key == $REQUEST_URI ? " SELECTED" : "") .">". check_select($value) ."</OPTION>\n"; foreach ($choices as $key => $value) $options .= "<OPTION VALUE=\"$key\"". ("/$key" == $REQUEST_URI ? " SELECTED" : "") .">". check_select($value) ."</OPTION>\n";
$output .= " <SELECT NAME=\"op\" ONCHANGE=\"visit(this.options[this.selectedIndex].value)\">$options</SELECT>\n"; $output .= " <SELECT NAME=\"op\" ONCHANGE=\"visit(this.options[this.selectedIndex].value)\">$options</SELECT>\n";
$output .= "</FORM>\n"; $output .= "</FORM>\n";
......
...@@ -29,6 +29,14 @@ function user_load($username) { ...@@ -29,6 +29,14 @@ function user_load($username) {
return new User($username); return new User($username);
} }
function user_rehash() {
global $user;
if ($user->id) {
$user = new User($user->userid);
session_register("user");
}
}
function user_save($account, $array) { function user_save($account, $array) {
// dynamically compose query: // dynamically compose query:
foreach ($array as $key=>$value) { foreach ($array as $key=>$value) {
...@@ -82,7 +90,7 @@ function user_set($account, $column, $name, $value) { ...@@ -82,7 +90,7 @@ function user_set($account, $column, $name, $value) {
} }
function user_access($account, $section = 0) { function user_access($account, $section = 0) {
// print $account->userid ." ". $account->access ."<P>"; global $user;
if ($section) return (user_get($account, "access", $section) || $account->id == 1); if ($section) return (user_get($account, "access", $section) || $account->id == 1);
else return ($account->access || $account->id == 1); else return ($account->access || $account->id == 1);
} }
......
...@@ -116,12 +116,12 @@ function access($name, $module) { ...@@ -116,12 +116,12 @@ function access($name, $module) {
$output .= "<B>Username:</B><BR>". check_output($account->userid) ."<P>\n"; $output .= "<B>Username:</B><BR>". check_output($account->userid) ."<P>\n";
$output .= "<B>Status:</B><BR><SELECT NAME=\"edit[status]\">\n$stat</SELECT><P>\n"; $output .= "<B>Status:</B><BR><SELECT NAME=\"edit[status]\">\n$stat</SELECT><P>\n";
$output .= "<B>Administrator access:</B><BR><SELECT NAME=\"edit[access][]\" MULTIPLE=\"true\" SIZE=\"10\">$access</SELECT><P>\n"; $output .= "<B>Administrator access:</B><BR><SELECT NAME=\"edit[access][]\" MULTIPLE=\"true\" SIZE=\"10\">$access</SELECT><P>\n";
$output .= "<B>Real name:</B><BR><INPUT NAME=\"edit[name]\" SIZE=\"55\" VALUE=\"$account->name\"><P>\n"; $output .= "<B>Real name:</B><BR><INPUT NAME=\"edit[name]\" SIZE=\"55\" VALUE=\"". check_textfield($account->name). "\"><P>\n";
$output .= "<B>Real e-mail address:</B><BR><INPUT NAME=\"edit[real_email]\" SIZE=\"55\" VALUE=\"$account->real_email\"><P>\n"; $output .= "<B>Real e-mail address:</B><BR><INPUT NAME=\"edit[real_email]\" SIZE=\"55\" VALUE=\"". check_textfield($account->real_email) ."\"><P>\n";
$output .= "<B>Fake e-mail address:</B><BR><INPUT NAME=\"edit[fake_email]\" SIZE=\"55\" VALUE=\"$account->fake_email\"><P>\n"; $output .= "<B>Fake e-mail address:</B><BR><INPUT NAME=\"edit[fake_email]\" SIZE=\"55\" VALUE=\"". check_textfield($account->fake_email) ."\"><P>\n";
$output .= "<B>URL of homepage:</B><BR><INPUT NAME=\"edit[url]\" SIZE=\"55\" VALUE=\"$account->url\"><P>\n"; $output .= "<B>URL of homepage:</B><BR><INPUT NAME=\"edit[url]\" SIZE=\"55\" VALUE=\"". check_textfield($account->url) ."\"><P>\n";
$output .= "<B>Bio information:</B><BR><TEXTAREA NAME=\"edit[bio]\" COLS=\"35\" ROWS=\"5\" WRAP=\"virtual\">$account->bio</TEXTAREA><P>\n"; $output .= "<B>Bio information:</B><BR><TEXTAREA NAME=\"edit[bio]\" COLS=\"35\" ROWS=\"5\" WRAP=\"virtual\">". check_textarea($account->bio) ."</TEXTAREA><P>\n";
$output .= "<B>Signature:</B><BR><TEXTAREA NAME=\"edit[signature]\" COLS=\"35\" ROWS=\"5\" WRAP=\"virtual\">$account->signature</TEXTAREA><P>\n"; $output .= "<B>Signature:</B><BR><TEXTAREA NAME=\"edit[signature]\" COLS=\"35\" ROWS=\"5\" WRAP=\"virtual\">". check_textarea($account->signature) ."</TEXTAREA><P>\n";
$output .= "<INPUT TYPE=\"hidden\" NAME=\"name\" VALUE=\"$account->userid\">\n"; $output .= "<INPUT TYPE=\"hidden\" NAME=\"name\" VALUE=\"$account->userid\">\n";
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"View account\">\n"; $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"View account\">\n";
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save account\">\n"; $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save account\">\n";
......
...@@ -80,7 +80,7 @@ function book_toc($parent = 0, $offset = 0, $toc = array()) { ...@@ -80,7 +80,7 @@ function book_toc($parent = 0, $offset = 0, $toc = array()) {
$result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight"); $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight");
while ($node = db_fetch_object($result)) { while ($node = db_fetch_object($result)) {
$toc[$node->nid] = ($offset ? $offset : "") ."". ++$number .". $node->title"; $toc[$node->nid] = ($offset ? $offset : "") ."". ++$number .". $node->title";
$toc = book_toc($node->nid, ($offset ? "$offset." : "") ."$number.", $toc); $toc = book_toc($node->nid, ($offset ? $offset : "") ."$number.", $toc);
} }
return $toc; return $toc;
} }
......
...@@ -80,7 +80,7 @@ function book_toc($parent = 0, $offset = 0, $toc = array()) { ...@@ -80,7 +80,7 @@ function book_toc($parent = 0, $offset = 0, $toc = array()) {
$result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight"); $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight");
while ($node = db_fetch_object($result)) { while ($node = db_fetch_object($result)) {
$toc[$node->nid] = ($offset ? $offset : "") ."". ++$number .". $node->title"; $toc[$node->nid] = ($offset ? $offset : "") ."". ++$number .". $node->title";
$toc = book_toc($node->nid, ($offset ? "$offset." : "") ."$number.", $toc); $toc = book_toc($node->nid, ($offset ? $offset : "") ."$number.", $toc);
} }
return $toc; return $toc;
} }
......
...@@ -99,8 +99,6 @@ function moderation_page() { ...@@ -99,8 +99,6 @@ function moderation_page() {
global $id, $op, $user, $vote; global $id, $op, $user, $vote;
if ($user->id) { if ($user->id) {
$user = user_load($user->userid);
switch($op) { switch($op) {
case "Vote"; case "Vote";
moderation_vote(check_input($id), check_input($vote)); moderation_vote(check_input($id), check_input($vote));
......
...@@ -45,7 +45,7 @@ function node_history($node) { ...@@ -45,7 +45,7 @@ function node_history($node) {
$theme->footer(); $theme->footer();
break; break;
default: default:
if ($user->id) user_load($user->userid); user_rehash();
node_view($node, 1); node_view($node, 1);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment